package html2text import "testing" func TestPlain(t *testing.T) { tests := map[string]string{} tests["this is a test"] = "this is a test" tests["thiS IS a Test"] = "thiS IS a Test" tests["thiS IS a Test :-)"] = "thiS IS a Test :-)" tests["

This is a test.

"] = "This is a test." tests["

Paragraph 1

Paragraph 2

"] = "Paragraph 1 Paragraph 2" tests["

Heading

Paragraph

"] = "Heading Paragraph" tests["Alphabet chars"] = "Alphabet chars" tests["Alphabet chars."] = "Alphabet chars." tests["
FirstSecond
"] = "First Second" tests[`

Heading

Paragraph

`] = "Heading Paragraph" tests[`

Heading

linked text

`] = "Heading linked text" // broken html tests[`

Heading

linked text.`] = "Heading linked text." for str, expected := range tests { res := Strip(str, false) if res != expected { t.Log("error:", res, "!=", expected) t.Fail() } } } func TestWithLinks(t *testing.T) { tests := map[string]string{} tests["this is a test"] = "this is a test" tests["thiS IS a Test"] = "thiS IS a Test" tests["thiS IS a Test :-)"] = "thiS IS a Test :-)" tests["

This is a test.

"] = "This is a test." tests["

Paragraph 1

Paragraph 2

"] = "Paragraph 1 Paragraph 2" tests["

Heading

Paragraph

"] = "Heading Paragraph" tests["Alphabet chars"] = "Alphabet chars" tests["Alphabet chars."] = "Alphabet chars." tests["
FirstSecond
"] = "First Second" tests["

Heading

Paragraph

"] = "Heading Paragraph" tests[`

Heading

Paragraph

`] = "Heading Paragraph" tests[`

Heading

linked text

`] = "Heading https://github.com linked text" // broken html tests[`

Heading

linked text.`] = "Heading https://github.com linked text." for str, expected := range tests { res := Strip(str, true) if res != expected { t.Log("error:", res, "!=", expected) t.Fail() } } } func BenchmarkPlain(b *testing.B) { for i := 0; i < b.N; i++ { Strip(htmlTestData, false) } } func BenchmarkLinks(b *testing.B) { for i := 0; i < b.N; i++ { Strip(htmlTestData, true) } } var htmlTestData = ` [axllent/mailpit] Run failed: .github/workflows/tests.yml - feature/swagger (284335a)
 
GitHub

[axllent/mailpit] .github/workflows/tests.yml workflow run

 
 

.github/workflows/tests.yml: No jobs were run

 
View workflow run
 
 
 


You are receiving this because you are subscribed to this thread.
Manage your GitHub Actions notifications

 

GitHub, Inc. ・88 Colin P Kelly Jr Street ・San Francisco, CA 94107

                                                           
`