blob: 79b019111f3d66864ae3876634f0b8dafad97b66 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
package html
import (
"os"
"testing"
"github.com/stretchr/testify/require"
"github.com/vektah/goparsify"
)
func TestParse(t *testing.T) {
goparsify.EnableLogging(os.Stdout)
result, err := parse(`<body>hello <p color="blue">world</p></body>`)
require.NoError(t, err)
require.Equal(t, htmlTag{Name: "body", Attributes: map[string]string{}, Body: []interface{}{
"hello ",
htmlTag{Name: "p", Attributes: map[string]string{"color": "blue"}, Body: []interface{}{"world"}},
}}, result)
}
|