gofmt -s -w .

This commit is contained in:
Nazar Kanaev
2021-04-06 08:43:15 +01:00
parent 614dcc8975
commit 2df2f41516
11 changed files with 30 additions and 34 deletions

View File

@@ -23,10 +23,9 @@ func TestQuery(t *testing.T) {
</html>
`))
nodes := Query(node, "p")
match := (
len(nodes) == 1 &&
match := (len(nodes) == 1 &&
nodes[0].Type == html.ElementNode &&
nodes[0].Data == "p")
nodes[0].Data == "p")
if !match {
t.Fatalf("incorrect match: %#v", nodes)
}
@@ -50,11 +49,10 @@ func TestQueryMulti(t *testing.T) {
</html>
`))
nodes := Query(node, "p , span")
match := (
len(nodes) == 3 &&
match := (len(nodes) == 3 &&
nodes[0].Type == html.ElementNode && nodes[0].Data == "p" &&
nodes[1].Type == html.ElementNode && nodes[1].Data == "p" &&
nodes[2].Type == html.ElementNode && nodes[2].Data == "span")
nodes[2].Type == html.ElementNode && nodes[2].Data == "span")
if !match {
for i, n := range nodes {
t.Logf("%d: %s", i, HTML(n))

View File

@@ -3,7 +3,7 @@ package htmlutil
import "testing"
func TestExtractText(t *testing.T) {
testcases := [][2]string {
testcases := [][2]string{
{"hello", "<div>hello</div>"},
{"hello world", "<div>hello</div> world"},
{"helloworld", "<div>hello</div>world"},