diff --git a/microdata_test.go b/microdata_test.go index f7eda9b..027a229 100644 --- a/microdata_test.go +++ b/microdata_test.go @@ -5,7 +5,8 @@ import ( "testing" ) -func ReadOneItem(html string, t *testing.T) *Item { + +func ReadData(html string, t *testing.T) *Microdata { p := NewParser(strings.NewReader(html)) data, err := p.Parse() @@ -17,9 +18,13 @@ func ReadOneItem(html string, t *testing.T) *Item { t.Errorf("Expected non-nil data") } - return data.items[0] + return data } +func ReadOneItem(html string, t *testing.T) *Item { + data := ReadData(html, t) + return data.items[0] +} func TestRead(t *testing.T) { html := ` @@ -234,3 +239,19 @@ func TestReadTimeDatetime(t *testing.T) { +func TestReadTwoValues(t *testing.T) { + html := ` +
+

Flavors in my favorite ice cream:

+ +
` + + item := ReadOneItem(html, t) + + if item.properties["birthday"][0].(string) != "2009-05-10" { + t.Errorf("Property value not found") + } +}