diff options
| author | Paul Buetow <paul@buetow.org> | 2024-11-19 10:56:44 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2024-11-19 10:56:44 +0200 |
| commit | 744c3b70fa590345f6c1de715e2a572f184091c4 (patch) | |
| tree | d198cf86b5afe2fbc7af42fdb0b1262c2f5bc30c /internal/entry/entry_test.go | |
| parent | f2318c4946db3ffd60a2b955e47660c2f77007df (diff) | |
initial inline to file path extraction
Diffstat (limited to 'internal/entry/entry_test.go')
| -rw-r--r-- | internal/entry/entry_test.go | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/internal/entry/entry_test.go b/internal/entry/entry_test.go index f88d848..6a54b05 100644 --- a/internal/entry/entry_test.go +++ b/internal/entry/entry_test.go @@ -126,43 +126,6 @@ func TestHasTag(t *testing.T) { } } -func TestExtractInlineTags(t *testing.T) { - table := map[string][]string{ - "foo,bar,baz blablablabla...": {"foo", "bar", "baz"}, - "foo.bar.baz blablablabla...": {"foo", "bar", "baz"}, - "foo.bar,baz blablablabla...": {"foo", "bar", "baz"}, - "foo,bar.baz blablablabla...": {"foo", "bar", "baz"}, - "share:li,foo this is the main content": {"share:li", "foo"}, - } - - for input, expectedTags := range table { - t.Run(input, func(t *testing.T) { - tags, contentWithoutTags, ok := extractInlineTags(input) - if !ok { - t.Error("expected inline tags but none were found") - } - if len(tags) != len(expectedTags) { - t.Errorf("expected %d inline tags (%v) but got %d (%v)", - len(expectedTags), expectedTags, len(tags), tags) - } - for _, expectedTag := range expectedTags { - if !slices.Contains(tags, expectedTag) { - t.Errorf("expected '%s' to be an inline tag but got '%v'", - expectedTag, tags) - } - } - parts := strings.Split(input, " ") - expectedMainContent := strings.Join(parts[1:], " ") - if contentWithoutTags != expectedMainContent { - t.Errorf("expected the main content to be '%s' but got '%s'", - expectedMainContent, contentWithoutTags) - } - - }) - } - -} - func FuzzExtractURLs(f *testing.F) { f.Add("/path?myjfa=lwsr4imj&dgqeg=m3uwwsak") f.Add("/?amfbm=bwzqu46m&xheuh=nv588d98") |
