Skip to content

Commit 14f368a

Browse files
committed
Tests
1 parent 29f613a commit 14f368a

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

html2text_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,25 @@ func TestHTML2Text(t *testing.T) {
6464
So(HTMLEntitiesToText("&abcdefghij;"), ShouldEqual, "&abcdefghij;")
6565
})
6666

67+
Convey("Numeric HTML Entities", func() {
68+
So(HTMLEntitiesToText("'single quotes' and 츝"), ShouldEqual, "'single quotes' and 츝")
69+
})
70+
6771
Convey("Full HTML structure", func() {
6872
So(HTML2Text(``), ShouldEqual, "")
6973
So(HTML2Text(`<html><head><title>Good</title></head><body>x</body>`), ShouldEqual, "x")
7074
So(HTML2Text(`we are not <script type="javascript"></script>interested in scripts`),
7175
ShouldEqual, "we are not interested in scripts")
7276
})
77+
78+
Convey("Switching Unix and Windows line breaks", func() {
79+
SetUnixLbr(true)
80+
So(HTML2Text(`two<br>line<br/>breaks`), ShouldEqual, "two\nline\nbreaks")
81+
So(HTML2Text(`<p>two</p><p>paragraphs</p>`), ShouldEqual, "two\n\nparagraphs")
82+
SetUnixLbr(false)
83+
So(HTML2Text(`two<br>line<br/>breaks`), ShouldEqual, "two\r\nline\r\nbreaks")
84+
So(HTML2Text(`<p>two</p><p>paragraphs</p>`), ShouldEqual, "two\r\n\r\nparagraphs")
85+
})
86+
7387
})
7488
}

0 commit comments

Comments
 (0)