summaryrefslogtreecommitdiff
path: root/html/html_test.go
blob: 6dca6d4ef22e83b51281b574065cb857085d2300 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package html

import (
	"testing"

	"github.com/stretchr/testify/require"
	. "github.com/vektah/goparsify"
)

func TestParse(t *testing.T) {
	result, _, err := Parse("<body>hello <b>world</b></body>")
	require.NoError(t, err)
	require.Equal(t, Tag{Name: "body", Attributes: map[string]string{}, Body: []Node{
		"hello ",
		Tag{Name: "b", Attributes: map[string]string{}, Body: []Node{"world"}},
	}}, result)
}