(t *testing.T)
| 542 | } |
| 543 | |
| 544 | func TestParserDocSetOnlyComments2(t *testing.T) { |
| 545 | const data = "---\n# comment-first\n" |
| 546 | |
| 547 | parsedVal, err := yamlmeta.NewParser(yamlmeta.ParserOpts{WithoutComments: false}).ParseBytes([]byte(data), "") |
| 548 | if err != nil { |
| 549 | t.Fatalf("error: %s", err) |
| 550 | } |
| 551 | |
| 552 | expectedVal := yamlmeta.NewDocumentSet(&yamlmeta.DocumentSetProto{ |
| 553 | Items: []*yamlmeta.DocumentProto{ |
| 554 | &yamlmeta.DocumentProto{ |
| 555 | Position: filepos.NewPosition(1), |
| 556 | }, |
| 557 | &yamlmeta.DocumentProto{ |
| 558 | Comments: []*yamlmeta.CommentProto{ |
| 559 | &yamlmeta.CommentProto{Data: " comment-first", Position: filepos.NewPosition(2)}, |
| 560 | }, |
| 561 | Position: filepos.NewUnknownPosition(), |
| 562 | }, |
| 563 | }, |
| 564 | Position: filepos.NewUnknownPosition(), |
| 565 | }) |
| 566 | |
| 567 | printer := yamlmeta.NewPrinterWithOpts(nil, yamlmeta.PrinterOpts{ExcludeRefs: true}) |
| 568 | |
| 569 | parsedValStr := printer.PrintStr(parsedVal) |
| 570 | expectedValStr := printer.PrintStr(expectedVal) |
| 571 | |
| 572 | assertEqual(t, parsedValStr, expectedValStr) |
| 573 | } |
| 574 | |
| 575 | func TestParserDocSetOnlyComments3(t *testing.T) { |
| 576 | const data = "--- # comment\n" |
nothing calls this directly
no test coverage detected
searching dependent graphs…