File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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\n line\n breaks" )
81+ So (HTML2Text (`<p>two</p><p>paragraphs</p>` ), ShouldEqual , "two\n \n paragraphs" )
82+ SetUnixLbr (false )
83+ So (HTML2Text (`two<br>line<br/>breaks` ), ShouldEqual , "two\r \n line\r \n breaks" )
84+ So (HTML2Text (`<p>two</p><p>paragraphs</p>` ), ShouldEqual , "two\r \n \r \n paragraphs" )
85+ })
86+
7387 })
7488}
You can’t perform that action at this time.
0 commit comments