mirror of
https://github.com/jimeh/undent.git
synced 2026-02-19 11:56:39 +00:00
52 lines
539 B
Go
52 lines
539 B
Go
package undent_test
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/jimeh/undent"
|
|
)
|
|
|
|
func ExampleBytes() {
|
|
b := undent.Bytes([]byte(`
|
|
{
|
|
"hello": "world"
|
|
}`,
|
|
))
|
|
|
|
fmt.Println(string(b))
|
|
// Output:
|
|
//
|
|
// {
|
|
// "hello": "world"
|
|
// }
|
|
}
|
|
|
|
func ExampleString() {
|
|
s := undent.String(`
|
|
{
|
|
"hello": "world"
|
|
}`,
|
|
)
|
|
fmt.Println(s)
|
|
// Output:
|
|
//
|
|
// {
|
|
// "hello": "world"
|
|
// }
|
|
}
|
|
|
|
func ExampleStringf() {
|
|
s := undent.Stringf(`
|
|
{
|
|
"hello": "%s"
|
|
}`,
|
|
"world",
|
|
)
|
|
fmt.Println(s)
|
|
// Output:
|
|
//
|
|
// {
|
|
// "hello": "world"
|
|
// }
|
|
}
|