MCPcopy
hub / github.com/carvel-dev/ytt / TestParserDocSetEmpty

Function TestParserDocSetEmpty

pkg/yamlmeta/parser_test.go:18–41  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

16var _ = fmt.Sprintf
17
18func TestParserDocSetEmpty(t *testing.T) {
19 const data = ""
20
21 parsedVal, err := yamlmeta.NewParser(yamlmeta.ParserOpts{WithoutComments: false}).ParseBytes([]byte(data), "")
22 if err != nil {
23 t.Fatalf("error: %s", err)
24 }
25
26 expectedVal := yamlmeta.NewDocumentSet(&yamlmeta.DocumentSetProto{
27 Items: []*yamlmeta.DocumentProto{
28 &yamlmeta.DocumentProto{
29 Position: filepos.NewPosition(1),
30 },
31 },
32 Position: filepos.NewUnknownPosition(),
33 })
34
35 printer := yamlmeta.NewPrinterWithOpts(nil, yamlmeta.PrinterOpts{ExcludeRefs: true})
36
37 parsedValStr := printer.PrintStr(parsedVal)
38 expectedValStr := printer.PrintStr(expectedVal)
39
40 assertEqual(t, parsedValStr, expectedValStr)
41}
42
43func TestParserDocSetNewline(t *testing.T) {
44 const data = "\n"

Callers

nothing calls this directly

Calls 8

NewParserFunction · 0.92
NewDocumentSetFunction · 0.92
NewPositionFunction · 0.92
NewUnknownPositionFunction · 0.92
NewPrinterWithOptsFunction · 0.92
assertEqualFunction · 0.85
ParseBytesMethod · 0.80
PrintStrMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…