From 744c3b70fa590345f6c1de715e2a572f184091c4 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Tue, 19 Nov 2024 10:56:44 +0200 Subject: initial inline to file path extraction --- internal/entry/entry_test.go | 37 ------------------------------------- 1 file changed, 37 deletions(-) (limited to 'internal/entry/entry_test.go') 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") -- cgit v1.2.3