goparsify/html/html_test.go
2017-08-06 23:32:10 +10:00

17 lines
419 B
Go

package html
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestParse(t *testing.T) {
result, _, err := Parse(`<body>hello <p color="blue">world</p></body>`)
require.NoError(t, err)
require.Equal(t, Tag{Name: "body", Attributes: map[string]string{}, Body: []interface{}{
"hello ",
Tag{Name: "p", Attributes: map[string]string{"color": "blue"}, Body: []interface{}{"world"}},
}}, result)
}