| 1 | package astscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/ast`/ |
| 2 | |
| 3 | import ( |
| 4 | "testingscip-go gomod github.com/golang/go/src go1.21.0 testing/" |
| 5 | |
| 6 | "github.com/goccy/go-yaml/tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/" |
| 7 | ) |
| 8 | |
| 9 | func TestEscapeSingleQuotescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/ast`/TestEscapeSingleQuote().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 10 | expected := `'Victor''s victory'` |
| 11 | got := escapeSingleQuotescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/ast`/escapeSingleQuote().("Victor's victory") |
| 12 | if got != expected { |
| 13 | t.Fatalfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Fatalf().("expected:%s\ngot:%s", expected, got) |
| 14 | } |
| 15 | } |
| 16 | |
| 17 | func TestReadNodescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/ast`/TestReadNode().(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 18 | t.Runscip-go gomod github.com/golang/go/src go1.21.0 testing/T#Run().("utf-8", func(t *testingscip-go gomod github.com/golang/go/src go1.21.0 testing/.Tscip-go gomod github.com/golang/go/src go1.21.0 testing/T#) { |
| 19 | value := "éɛทᛞ⠻チ▓🦄" |
| 20 | node := &StringNodescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/ast`/StringNode#{ |
| 21 | BaseNodescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/ast`/StringNode#BaseNode.: &BaseNodescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/ast`/BaseNode#{}, |
| 22 | Tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/ast`/StringNode#Token.: &tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Token#{}, |
| 23 | Valuescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/ast`/StringNode#Value.: value, |
| 24 | } |
| 25 | expectedSize := len(value) |
| 26 | gotBuffer := make([]byte, expectedSize) |
| 27 | expectedBuffer := []byte(value) |
| 28 | gotSize, _ := readNodescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/ast`/readNode().(gotBuffer, node) |
| 29 | if gotSize != expectedSize { |
| 30 | t.Fatalfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Fatalf().("expected size:%d\ngot:%d", expectedSize, gotSize) |
| 31 | } |
| 32 | if string(gotBuffer) != string(expectedBuffer) { |
| 33 | t.Fatalfscip-go gomod github.com/golang/go/src go1.21.0 testing/common#Fatalf().("expected buffer:%s\ngot:%s", expectedBuffer, gotBuffer) |
| 34 | } |
| 35 | }) |
| 36 | } |