goparsify/html/html_test.go

17 lines
419 B
Go
Raw Normal View History

2017-08-06 09:02:39 +02:00
package html
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestParse(t *testing.T) {
2017-08-06 09:28:34 +02:00
result, _, err := Parse(`<body>hello <p color="blue">world</p></body>`)
2017-08-06 09:02:39 +02:00
require.NoError(t, err)
2017-08-06 15:32:10 +02:00
require.Equal(t, Tag{Name: "body", Attributes: map[string]string{}, Body: []interface{}{
2017-08-06 09:02:39 +02:00
"hello ",
2017-08-06 15:32:10 +02:00
Tag{Name: "p", Attributes: map[string]string{"color": "blue"}, Body: []interface{}{"world"}},
2017-08-06 09:02:39 +02:00
}}, result)
}