(t *testing.T)
| 66 | } |
| 67 | |
| 68 | func TestParserOnlyComment(t *testing.T) { |
| 69 | const data = "#" |
| 70 | |
| 71 | parsedVal, err := yamlmeta.NewParser(yamlmeta.ParserOpts{WithoutComments: false}).ParseBytes([]byte(data), "") |
| 72 | if err != nil { |
| 73 | t.Fatalf("error: %s", err) |
| 74 | } |
| 75 | |
| 76 | expectedVal := yamlmeta.NewDocumentSet(&yamlmeta.DocumentSetProto{ |
| 77 | Items: []*yamlmeta.DocumentProto{ |
| 78 | &yamlmeta.DocumentProto{ |
| 79 | Position: filepos.NewPosition(1), |
| 80 | }, |
| 81 | &yamlmeta.DocumentProto{ |
| 82 | Comments: []*yamlmeta.CommentProto{ |
| 83 | &yamlmeta.CommentProto{Data: "", Position: filepos.NewPosition(1)}, |
| 84 | }, |
| 85 | Position: filepos.NewUnknownPosition(), |
| 86 | }, |
| 87 | }, |
| 88 | Position: filepos.NewUnknownPosition(), |
| 89 | }) |
| 90 | |
| 91 | printer := yamlmeta.NewPrinterWithOpts(nil, yamlmeta.PrinterOpts{ExcludeRefs: true}) |
| 92 | |
| 93 | parsedValStr := printer.PrintStr(parsedVal) |
| 94 | expectedValStr := printer.PrintStr(expectedVal) |
| 95 | |
| 96 | if parsedValStr != expectedValStr { |
| 97 | t.Fatalf("not equal\nparsed:\n>>>%s<<<expected:\n>>>%s<<<", parsedValStr, expectedValStr) |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | func TestParserDoc(t *testing.T) { |
| 102 | const data = "---\n" |
nothing calls this directly
no test coverage detected
searching dependent graphs…