From 433c1b711161c1f7038df4f147ac316307068194 Mon Sep 17 00:00:00 2001 From: Ian Davis Date: Thu, 7 Jun 2012 00:55:09 +0100 Subject: [PATCH] Initial commit --- microdata_test.go | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) 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") + } +}