diff options
Diffstat (limited to '')
-rw-r--r-- | dependencies/pkg/mod/github.com/goccy/go-yaml@v1.9.6/ast/ast_test.go | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.9.6/ast/ast_test.go b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.9.6/ast/ast_test.go new file mode 100644 index 0000000..e7022b6 --- /dev/null +++ b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.9.6/ast/ast_test.go @@ -0,0 +1,36 @@ +package ast + +import ( + "testing" + + "github.com/goccy/go-yaml/token" +) + +func TestEscapeSingleQuote(t *testing.T) { + expected := `'Victor''s victory'` + got := escapeSingleQuote("Victor's victory") + if got != expected { + t.Fatalf("expected:%s\ngot:%s", expected, got) + } +} + +func TestReadNode(t *testing.T) { + t.Run("utf-8", func(t *testing.T) { + value := "éɛทᛞ⠻チ▓🦄" + node := &StringNode{ + BaseNode: &BaseNode{}, + Token: &token.Token{}, + Value: value, + } + expectedSize := len(value) + gotBuffer := make([]byte, expectedSize) + expectedBuffer := []byte(value) + gotSize, _ := readNode(gotBuffer, node) + if gotSize != expectedSize { + t.Fatalf("expected size:%d\ngot:%d", expectedSize, gotSize) + } + if string(gotBuffer) != string(expectedBuffer) { + t.Fatalf("expected buffer:%s\ngot:%s", expectedBuffer, gotBuffer) + } + }) +} |