diff options
author | tjpcc <tjp@ctrl-c.club> | 2023-01-14 09:57:16 -0700 |
---|---|---|
committer | tjpcc <tjp@ctrl-c.club> | 2023-01-14 09:58:32 -0700 |
commit | 0d904f9f10590d3a9117af27151f8c4fe2aea5ff (patch) | |
tree | 95a6f1a0055bdb2120684c239a14c7466a3a117f /gemtext/parse_line_test.go | |
parent | aa23984bc21f99e00b8552e928d23ef02bb745f3 (diff) |
Completed gemtext package.
resolves #2
- fuzz testing
- split out line parsing into a separate file
- changed line type-specific public []byte fields to string accessor methods
- added document parsing test for a stress test doc
- added dependency on stretchr/testify
Diffstat (limited to 'gemtext/parse_line_test.go')
-rw-r--r-- | gemtext/parse_line_test.go | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/gemtext/parse_line_test.go b/gemtext/parse_line_test.go index 64c1bc7..0953103 100644 --- a/gemtext/parse_line_test.go +++ b/gemtext/parse_line_test.go @@ -46,12 +46,12 @@ func TestParseLinkLine(t *testing.T) { t.Fatalf("expected a LinkLine, got %T", line) } - if string(link.URL) != test.url { - t.Errorf("expected url %q, got %q", test.url, string(link.URL)) + if link.URL() != test.url { + t.Errorf("expected url %q, got %q", test.url, link.URL()) } - if string(link.Label) != test.label { - t.Errorf("expected label %q, got %q", test.label, string(link.Label)) + if link.Label() != test.label { + t.Errorf("expected label %q, got %q", test.label, link.Label()) } }) } @@ -93,8 +93,8 @@ func TestParsePreformatToggleLine(t *testing.T) { t.Fatalf("expected a PreformatToggleLine, got %T", line) } - if string(toggle.AltText) != test.altText { - t.Errorf("expected alt-text %q, got %q", test.altText, string(toggle.AltText)) + if toggle.AltText() != test.altText { + t.Errorf("expected alt-text %q, got %q", test.altText, toggle.AltText()) } }) } @@ -147,8 +147,8 @@ func TestParseHeadingLine(t *testing.T) { t.Fatalf("expected HeadingLine, got a %T", line) } - if string(hdg.Body) != test.body { - t.Errorf("expected body %q, got %q", test.body, string(hdg.Body)) + if hdg.Body() != test.body { + t.Errorf("expected body %q, got %q", test.body, hdg.Body()) } }) } @@ -188,8 +188,8 @@ func TestParseListItemLine(t *testing.T) { t.Fatalf("expected ListItemLine, got a %T", line) } - if string(li.Body) != test.body { - t.Errorf("expected body %q, got %q", test.body, string(li.Body)) + if li.Body() != test.body { + t.Errorf("expected body %q, got %q", test.body, li.Body()) } }) } @@ -233,8 +233,8 @@ func TestParseQuoteLine(t *testing.T) { t.Fatalf("expected QuoteLine , got a %T", line) } - if string(qu.Body) != test.body { - t.Errorf("expected body %q, got %q", test.body, string(qu.Body)) + if qu.Body() != test.body { + t.Errorf("expected body %q, got %q", test.body, qu.Body()) } }) } |