X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=libgo%2Fgo%2Fencoding%2Fxml%2Fread_test.go;h=8df09b3cceea01a9e7a34452a5ed4328bee4dd47;hb=99da81c4ae656f337b7d42d2e46a5b575da6b06a;hp=833eafc9a586909637a626eb902e0894e1ce589b;hpb=c3f35a0f3788ed6f0a90fc4fae692fb6f9497c01;p=pf3gnuchains%2Fgcc-fork.git diff --git a/libgo/go/encoding/xml/read_test.go b/libgo/go/encoding/xml/read_test.go index 833eafc9a58..8df09b3ccee 100644 --- a/libgo/go/encoding/xml/read_test.go +++ b/libgo/go/encoding/xml/read_test.go @@ -7,6 +7,7 @@ package xml import ( "reflect" "testing" + "time" ) // Stripped down Atom feed data structures. @@ -24,7 +25,7 @@ func TestUnmarshalFeed(t *testing.T) { // hget http://codereview.appspot.com/rss/mine/rsc const atomFeedString = ` -Code Review - My issueshttp://codereview.appspot.com/2009-10-04T01:35:58+00:00rietveld<>rietveld: an attempt at pubsubhubbub +<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-us" updated="2009-10-04T01:35:58+00:00"><title>Code Review - My issueshttp://codereview.appspot.com/rietveld<>rietveld: an attempt at pubsubhubbub 2009-10-04T01:35:58+00:00email-address-removedurn:md5:134d9179c41f806be79b3a5f7877d19a An attempt at adding pubsubhubbub support to Rietveld. http://code.google.com/p/pubsubhubbub @@ -78,26 +79,26 @@ not being used from outside intra_region_diff.py. ` type Feed struct { - XMLName Name `xml:"http://www.w3.org/2005/Atom feed"` - Title string `xml:"title"` - Id string `xml:"id"` - Link []Link `xml:"link"` - Updated Time `xml:"updated"` - Author Person `xml:"author"` - Entry []Entry `xml:"entry"` + XMLName Name `xml:"http://www.w3.org/2005/Atom feed"` + Title string `xml:"title"` + Id string `xml:"id"` + Link []Link `xml:"link"` + Updated time.Time `xml:"updated,attr"` + Author Person `xml:"author"` + Entry []Entry `xml:"entry"` } type Entry struct { - Title string `xml:"title"` - Id string `xml:"id"` - Link []Link `xml:"link"` - Updated Time `xml:"updated"` - Author Person `xml:"author"` - Summary Text `xml:"summary"` + Title string `xml:"title"` + Id string `xml:"id"` + Link []Link `xml:"link"` + Updated time.Time `xml:"updated"` + Author Person `xml:"author"` + Summary Text `xml:"summary"` } type Link struct { - Rel string `xml:"rel,attr"` + Rel string `xml:"rel,attr,omitempty"` Href string `xml:"href,attr"` } @@ -109,12 +110,10 @@ type Person struct { } type Text struct { - Type string `xml:"type,attr"` + Type string `xml:"type,attr,omitempty"` Body string `xml:",chardata"` } -type Time string - var atomFeed = Feed{ XMLName: Name{"http://www.w3.org/2005/Atom", "feed"}, Title: "Code Review - My issues", @@ -123,7 +122,7 @@ var atomFeed = Feed{ {Rel: "self", Href: "http://codereview.appspot.com/rss/mine/rsc"}, }, Id: "http://codereview.appspot.com/", - Updated: "2009-10-04T01:35:58+00:00", + Updated: ParseTime("2009-10-04T01:35:58+00:00"), Author: Person{ Name: "rietveld<>", InnerXML: "rietveld<>", @@ -134,7 +133,7 @@ var atomFeed = Feed{ Link: []Link{ {Rel: "alternate", Href: "http://codereview.appspot.com/126085"}, }, - Updated: "2009-10-04T01:35:58+00:00", + Updated: ParseTime("2009-10-04T01:35:58+00:00"), Author: Person{ Name: "email-address-removed", InnerXML: "email-address-removed", @@ -181,7 +180,7 @@ the top of feeds.py marked NOTE(rsc). Link: []Link{ {Rel: "alternate", Href: "http://codereview.appspot.com/124106"}, }, - Updated: "2009-10-03T23:02:17+00:00", + Updated: ParseTime("2009-10-03T23:02:17+00:00"), Author: Person{ Name: "email-address-removed", InnerXML: "email-address-removed",