diff options
author | Frédéric Guillot <fred@miniflux.net> | 2019-11-28 20:11:39 -0800 |
---|---|---|
committer | Frédéric Guillot <fred@miniflux.net> | 2019-11-28 21:33:12 -0800 |
commit | c43c9458a95552f0a68084a91c631e9e45713a19 (patch) | |
tree | 492d63d911218dd5aee150645aabb69e7d082342 /reader/rewrite/rewriter_test.go | |
parent | 90064a8cf02e67dbe796a7bb88d39705344d14ee (diff) |
Add rewrite functions: convert_text_link and nl2br
Diffstat (limited to 'reader/rewrite/rewriter_test.go')
-rw-r--r-- | reader/rewrite/rewriter_test.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/reader/rewrite/rewriter_test.go b/reader/rewrite/rewriter_test.go index 0fd49ba..27cf425 100644 --- a/reader/rewrite/rewriter_test.go +++ b/reader/rewrite/rewriter_test.go @@ -156,3 +156,23 @@ func TestRewriteWithUnknownLazyNoScriptImage(t *testing.T) { t.Errorf(`Not expected output: got "%s" instead of "%s"`, output, expected) } } + +func TestNewLineRewriteRule(t *testing.T) { + description := "A\nB\nC" + output := Rewriter("https://example.org/article", description, "nl2br") + expected := `A<br>B<br>C` + + if expected != output { + t.Errorf(`Not expected output: got %q instead of %q`, output, expected) + } +} + +func TestConvertTextLinkRewriteRule(t *testing.T) { + description := "Test: http://example.org/a/b" + output := Rewriter("https://example.org/article", description, "convert_text_link") + expected := `Test: <a href="http://example.org/a/b">http://example.org/a/b</a>` + + if expected != output { + t.Errorf(`Not expected output: got %q instead of %q`, output, expected) + } +} |