goparsify/html/html_test.go

17 lines
416 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-09 13:18:14 +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)
}