File: dom_representation.go

package info (click to toggle)
golang-github-johanneskaufmann-html-to-markdown 2.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,084 kB
  • sloc: makefile: 3
file content (20 lines) | stat: -rw-r--r-- 457 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package tester

import (
	"strings"
	"testing"

	"github.com/JohannesKaufmann/dom"
	"golang.org/x/net/html"
)

func ExpectRepresentation(t *testing.T, doc *html.Node, name string, expectedHtml string) {
	actualHtml := dom.RenderRepresentation(doc)

	actualHtml = strings.TrimSpace(actualHtml)
	expectedHtml = strings.TrimSpace(expectedHtml)

	if actualHtml != expectedHtml {
		t.Errorf("%s: expected \n%s\nbut got\n%s", name, expectedHtml, actualHtml)
	}
}