1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
12 // Stripped down Atom feed data structures.
14 func TestUnmarshalFeed(t
*testing
.T
) {
16 if err
:= Unmarshal(StringReader(rssFeedString
), &f
); err
!= nil {
17 t
.Fatalf("Unmarshal: %s", err
)
19 if !reflect
.DeepEqual(f
, rssFeed
) {
20 t
.Fatalf("have %#v\nwant %#v", f
, rssFeed
)
24 // hget http://codereview.appspot.com/rss/mine/rsc
25 const rssFeedString
= `
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"></link><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</updated><author><name>rietveld<></name></author><entry><title>rietveld: an attempt at pubsubhubbub
28 </title><link hre-f="http://codereview.appspot.com/126085" rel="alternate"></link><updated>2009-10-04T01:35:58+00:00</updated><author><name>email-address-removed</name></author><id>urn:md5:134d9179c41f806be79b3a5f7877d19a</id><summary type="html">
29 An attempt at adding pubsubhubbub support to Rietveld.
30 http://code.google.com/p/pubsubhubbub
31 http://code.google.com/p/rietveld/issues/detail?id=155
33 The server side of the protocol is trivial:
34 1. add a &lt;link rel=&quot;hub&quot; href=&quot;hub-server&quot;&gt; tag to all
35 feeds that will be pubsubhubbubbed.
36 2. every time one of those feeds changes, tell the hub
37 with a simple POST request.
39 I have tested this by adding debug prints to a local hub
40 server and checking that the server got the right publish
43 I can&#39;t quite get the server to work, but I think the bug
44 is not in my code. I think that the server expects to be
45 able to grab the feed and see the feed&#39;s actual URL in
46 the link rel=&quot;self&quot;, but the default value for that drops
47 the :port from the URL, and I cannot for the life of me
48 figure out how to get the Atom generator deep inside
49 django not to do that, or even where it is doing that,
50 or even what code is running to generate the Atom feed.
51 (I thought I knew but I added some assert False statements
54 Ignoring that particular problem, I would appreciate
55 feedback on the right way to get the two values at
56 the top of feeds.py marked NOTE(rsc).
59 </summary></entry><entry><title>rietveld: correct tab handling
60 </title><link href="http://codereview.appspot.com/124106" rel="alternate"></link><updated>2009-10-03T23:02:17+00:00</updated><author><name>email-address-removed</name></author><id>urn:md5:0a2a4f19bb815101f0ba2904aed7c35a</id><summary type="html">
61 This fixes the buggy tab rendering that can be seen at
62 http://codereview.appspot.com/116075/diff/1/2
64 The fundamental problem was that the tab code was
65 not being told what column the text began in, so it
66 didn&#39;t know where to put the tab stops. Another problem
67 was that some of the code assumed that string byte
68 offsets were the same as column offsets, which is only
69 true if there are no tabs.
71 In the process of fixing this, I cleaned up the arguments
72 to Fold and ExpandTabs and renamed them Break and
73 _ExpandTabs so that I could be sure that I found all the
74 call sites. I also wanted to verify that ExpandTabs was
75 not being used from outside intra_region_diff.py.
78 </summary></entry></feed> `
81 XMLName Name
"http://www.w3.org/2005/Atom feed"
108 InnerXML
string "innerxml"
113 Body
string "chardata"
119 XMLName
: Name
{"http://www.w3.org/2005/Atom", "feed"},
120 Title
: "Code Review - My issues",
122 {Rel
: "alternate", Href
: "http://codereview.appspot.com/"},
123 {Rel
: "self", Href
: "http://codereview.appspot.com/rss/mine/rsc"},
125 Id
: "http://codereview.appspot.com/",
126 Updated
: "2009-10-04T01:35:58+00:00",
129 InnerXML
: "<name>rietveld<></name>",
133 Title
: "rietveld: an attempt at pubsubhubbub\n",
135 {Rel
: "alternate", Href
: "http://codereview.appspot.com/126085"},
137 Updated
: "2009-10-04T01:35:58+00:00",
139 Name
: "email-address-removed",
140 InnerXML
: "<name>email-address-removed</name>",
142 Id
: "urn:md5:134d9179c41f806be79b3a5f7877d19a",
146 An attempt at adding pubsubhubbub support to Rietveld.
147 http://code.google.com/p/pubsubhubbub
148 http://code.google.com/p/rietveld/issues/detail?id=155
150 The server side of the protocol is trivial:
151 1. add a <link rel="hub" href="hub-server"> tag to all
152 feeds that will be pubsubhubbubbed.
153 2. every time one of those feeds changes, tell the hub
154 with a simple POST request.
156 I have tested this by adding debug prints to a local hub
157 server and checking that the server got the right publish
160 I can't quite get the server to work, but I think the bug
161 is not in my code. I think that the server expects to be
162 able to grab the feed and see the feed's actual URL in
163 the link rel="self", but the default value for that drops
164 the :port from the URL, and I cannot for the life of me
165 figure out how to get the Atom generator deep inside
166 django not to do that, or even where it is doing that,
167 or even what code is running to generate the Atom feed.
168 (I thought I knew but I added some assert False statements
169 and it kept running!)
171 Ignoring that particular problem, I would appreciate
172 feedback on the right way to get the two values at
173 the top of feeds.py marked NOTE(rsc).
180 Title
: "rietveld: correct tab handling\n",
182 {Rel
: "alternate", Href
: "http://codereview.appspot.com/124106"},
184 Updated
: "2009-10-03T23:02:17+00:00",
186 Name
: "email-address-removed",
187 InnerXML
: "<name>email-address-removed</name>",
189 Id
: "urn:md5:0a2a4f19bb815101f0ba2904aed7c35a",
193 This fixes the buggy tab rendering that can be seen at
194 http://codereview.appspot.com/116075/diff/1/2
196 The fundamental problem was that the tab code was
197 not being told what column the text began in, so it
198 didn't know where to put the tab stops. Another problem
199 was that some of the code assumed that string byte
200 offsets were the same as column offsets, which is only
201 true if there are no tabs.
203 In the process of fixing this, I cleaned up the arguments
204 to Fold and ExpandTabs and renamed them Break and
205 _ExpandTabs so that I could be sure that I found all the
206 call sites. I also wanted to verify that ExpandTabs was
207 not being used from outside intra_region_diff.py.
216 type FieldNameTest
struct {
220 var FieldNameTests
= []FieldNameTest
{
221 {"Profile-Image", "profileimage"},
225 func TestFieldName(t
*testing
.T
) {
226 for _
, tt
:= range FieldNameTests
{
227 a
:= fieldName(tt
.in
)
229 t
.Fatalf("have %#v\nwant %#v\n\n", a
, tt
.out
)