diff options
| author | Nicolas Sterchele <nicolas@sterchelen.net> | 2022-08-31 23:08:52 +0200 |
|---|---|---|
| committer | Nicolas Sterchele <nicolas@sterchelen.net> | 2022-08-31 23:19:58 +0200 |
| commit | b9281c89737419216b710a87c31686d21adf86bc (patch) | |
| tree | bc2b2c73b35ead61bee37b75aec1eee2d78c6ef4 /text_test.go | |
initial commit
Thanks to Ted Unangst for its work.
Originally available here https://humungus.tedunangst.com/r/inks
Diffstat (limited to 'text_test.go')
| -rwxr-xr-x | text_test.go | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/text_test.go b/text_test.go new file mode 100755 index 0000000..3ec30af --- /dev/null +++ b/text_test.go @@ -0,0 +1,39 @@ +package main + +import "testing" + +func TestHtml(t *testing.T) { + in := + `> we start with a quote + +A comment. I liked it. + +> feature one +> feature two +> feature three + +nice! +` + + out := `<blockquote>we start with a quote</blockquote> +<p>A comment. I liked it. +<p><blockquote>feature one<br> +feature two<br> +feature three</blockquote> +<p>nice!` + rv := string(htmlify(in)) + if rv != out { + t.Errorf("failure.\nresult: %s\nexpected: %s\n", rv, out) + } + + in = `> one quote + +> two quote` + out = `<blockquote>one quote</blockquote> +<p><blockquote>two quote</blockquote>` + + rv = string(htmlify(in)) + if rv != out { + t.Errorf("failure.\nresult: %s\nexpected: %s\n", rv, out) + } +} |
