Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(618)

Side by Side Diff: src/pkg/xml/read_test.go

Issue 1009041: code review 1009041: xml: fix innerxml handling of & escapes (Closed)
Patch Set: code review 1009041: xml: fix innerxml handling of & escapes Created 14 years, 10 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/pkg/xml/xml.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package xml 5 package xml
6 6
7 import ( 7 import (
8 "reflect" 8 "reflect"
9 "testing" 9 "testing"
10 ) 10 )
11 11
12 // Stripped down Atom feed data structures. 12 // Stripped down Atom feed data structures.
13 13
14 func TestUnmarshalFeed(t *testing.T) { 14 func TestUnmarshalFeed(t *testing.T) {
15 var f Feed 15 var f Feed
16 if err := Unmarshal(StringReader(rssFeedString), &f); err != nil { 16 if err := Unmarshal(StringReader(rssFeedString), &f); err != nil {
17 t.Fatalf("Unmarshal: %s", err) 17 t.Fatalf("Unmarshal: %s", err)
18 } 18 }
19 if !reflect.DeepEqual(f, rssFeed) { 19 if !reflect.DeepEqual(f, rssFeed) {
20 t.Fatalf("have %#v\nwant %#v", f, rssFeed) 20 t.Fatalf("have %#v\nwant %#v", f, rssFeed)
21 } 21 }
22 } 22 }
23 23
24 // hget http://codereview.appspot.com/rss/mine/rsc 24 // hget http://codereview.appspot.com/rss/mine/rsc
25 const rssFeedString = ` 25 const rssFeedString = `
26 <?xml version="1.0" encoding="utf-8"?> 26 <?xml version="1.0" encoding="utf-8"?>
27 <feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-us"><title>Code Review - My issues</title><link href="http://codereview.appspot.com/" rel="alternate"></l ink><li-nk href="http://codereview.appspot.com/rss/mine/rsc" rel="self"></li-nk> <id>http://codereview.appspot.com/</id><updated>2009-10-04T01:35:58+00:00</updat ed><author><name>rietveld</name></author><entry><title>rietveld: an attempt at p ubsubhubbub 27 <feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-us"><title>Code Review - My issues</title><link href="http://codereview.appspot.com/" rel="alternate"></l ink><li-nk href="http://codereview.appspot.com/rss/mine/rsc" rel="self"></li-nk> <id>http://codereview.appspot.com/</id><updated>2009-10-04T01:35:58+00:00</updat ed><author><name>rietveld&lt;&gt;</name></author><entry><title>rietveld: an atte mpt at pubsubhubbub
28 </title><link hre-f="http://codereview.appspot.com/126085" rel="alternate"></lin k><updated>2009-10-04T01:35:58+00:00</updated><author><name>email-address-remove d</name></author><id>urn:md5:134d9179c41f806be79b3a5f7877d19a</id><summary type= "html"> 28 </title><link hre-f="http://codereview.appspot.com/126085" rel="alternate"></lin k><updated>2009-10-04T01:35:58+00:00</updated><author><name>email-address-remove d</name></author><id>urn:md5:134d9179c41f806be79b3a5f7877d19a</id><summary type= "html">
29 An attempt at adding pubsubhubbub support to Rietveld. 29 An attempt at adding pubsubhubbub support to Rietveld.
30 http://code.google.com/p/pubsubhubbub 30 http://code.google.com/p/pubsubhubbub
31 http://code.google.com/p/rietveld/issues/detail?id=155 31 http://code.google.com/p/rietveld/issues/detail?id=155
32 32
33 The server side of the protocol is trivial: 33 The server side of the protocol is trivial:
34 1. add a &amp;lt;link rel=&amp;quot;hub&amp;quot; href=&amp;quot;hub-server&am p;quot;&amp;gt; tag to all 34 1. add a &amp;lt;link rel=&amp;quot;hub&amp;quot; href=&amp;quot;hub-server&am p;quot;&amp;gt; tag to all
35 feeds that will be pubsubhubbubbed. 35 feeds that will be pubsubhubbubbed.
36 2. every time one of those feeds changes, tell the hub 36 2. every time one of those feeds changes, tell the hub
37 with a simple POST request. 37 with a simple POST request.
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 var rssFeed = Feed{ 118 var rssFeed = Feed{
119 XMLName: Name{"http://www.w3.org/2005/Atom", "feed"}, 119 XMLName: Name{"http://www.w3.org/2005/Atom", "feed"},
120 Title: "Code Review - My issues", 120 Title: "Code Review - My issues",
121 Link: []Link{ 121 Link: []Link{
122 Link{Rel: "alternate", Href: "http://codereview.appspot.com/"}, 122 Link{Rel: "alternate", Href: "http://codereview.appspot.com/"},
123 Link{Rel: "self", Href: "http://codereview.appspot.com/rss/mine/ rsc"}, 123 Link{Rel: "self", Href: "http://codereview.appspot.com/rss/mine/ rsc"},
124 }, 124 },
125 Id: "http://codereview.appspot.com/", 125 Id: "http://codereview.appspot.com/",
126 Updated: "2009-10-04T01:35:58+00:00", 126 Updated: "2009-10-04T01:35:58+00:00",
127 Author: Person{ 127 Author: Person{
128 » » Name: "rietveld", 128 » » Name: "rietveld<>",
129 » » InnerXML: "<name>rietveld</name>", 129 » » InnerXML: "<name>rietveld&lt;&gt;</name>",
130 }, 130 },
131 Entry: []Entry{ 131 Entry: []Entry{
132 Entry{ 132 Entry{
133 Title: "rietveld: an attempt at pubsubhubbub\n", 133 Title: "rietveld: an attempt at pubsubhubbub\n",
134 Link: []Link{ 134 Link: []Link{
135 Link{Rel: "alternate", Href: "http://codereview. appspot.com/126085"}, 135 Link{Rel: "alternate", Href: "http://codereview. appspot.com/126085"},
136 }, 136 },
137 Updated: "2009-10-04T01:35:58+00:00", 137 Updated: "2009-10-04T01:35:58+00:00",
138 Author: Person{ 138 Author: Person{
139 Name: "email-address-removed", 139 Name: "email-address-removed",
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 } 223 }
224 224
225 func TestFieldName(t *testing.T) { 225 func TestFieldName(t *testing.T) {
226 for _, tt := range FieldNameTests { 226 for _, tt := range FieldNameTests {
227 a := fieldName(tt.in) 227 a := fieldName(tt.in)
228 if a != tt.out { 228 if a != tt.out {
229 t.Fatalf("have %#v\nwant %#v\n\n", a, tt.out) 229 t.Fatalf("have %#v\nwant %#v\n\n", a, tt.out)
230 } 230 }
231 } 231 }
232 } 232 }
OLDNEW
« no previous file with comments | « no previous file | src/pkg/xml/xml.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b