feedtools 0.2.14 → 0.2.15

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ == FeedTools 0.2.15
2
+ * changed so that tidied elements no longer handle entities differently
3
+ * tidy now assumes utf-8 encoding instead of ascii
4
+ * began the first bit of work on namespace support
5
+ * better support for cdatas
6
+ * removed "bozo bit" - no need for a parser to moonlight as a validator
1
7
  == FeedTools 0.2.14
2
8
  * fixed bug with feeds not expiring properly
3
9
  == FeedTools 0.2.13
data/lib/feed_tools.rb CHANGED
@@ -32,7 +32,54 @@ FEED_TOOLS_ENV = ENV['FEED_TOOLS_ENV'] ||
32
32
  ENV['RAILS_ENV'] ||
33
33
  'production' # :nodoc:
34
34
 
35
- FEED_TOOLS_VERSION = "0.2.14"
35
+ FEED_TOOLS_VERSION = "0.2.15"
36
+
37
+ FEED_TOOLS_NAMESPACES = {
38
+ "admin" => "http://webns.net/mvcb/",
39
+ "ag" => "http://purl.org/rss/1.0/modules/aggregation/",
40
+ "annotate" => "http://purl.org/rss/1.0/modules/annotate/",
41
+ "atom" => "http://www.w3.org/2005/Atom",
42
+ "audio" => "http://media.tangent.org/rss/1.0/",
43
+ "blogChannel" => "http://backend.userland.com/blogChannelModule",
44
+ "cc" => "http://web.resource.org/cc/",
45
+ "creativeCommons" => "http://backend.userland.com/creativeCommonsRssModule",
46
+ "co" => "http://purl.org/rss/1.0/modules/company",
47
+ "content" => "http://purl.org/rss/1.0/modules/content/",
48
+ "cp" => "http://my.theinfo.org/changed/1.0/rss/",
49
+ "dc" => "http://purl.org/dc/elements/1.1/",
50
+ "dcterms" => "http://purl.org/dc/terms/",
51
+ "email" => "http://purl.org/rss/1.0/modules/email/",
52
+ "ev" => "http://purl.org/rss/1.0/modules/event/",
53
+ "icbm" => "http://postneo.com/icbm/",
54
+ "image" => "http://purl.org/rss/1.0/modules/image/",
55
+ "feedburner" => "http://rssnamespace.org/feedburner/ext/1.0",
56
+ "foaf" => "http://xmlns.com/foaf/0.1/",
57
+ "fm" => "http://freshmeat.net/rss/fm/",
58
+ "itunes" => "http://www.itunes.com/DTDs/Podcast-1.0.dtd",
59
+ "l" => "http://purl.org/rss/1.0/modules/link/",
60
+ "media" => "http://search.yahoo.com/mrss",
61
+ "pingback" => "http://madskills.com/public/xml/rss/module/pingback/",
62
+ "prism" => "http://prismstandard.org/namespaces/1.2/basic/",
63
+ "rdf" => "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
64
+ "rdfs" => "http://www.w3.org/2000/01/rdf-schema#",
65
+ "ref" => "http://purl.org/rss/1.0/modules/reference/",
66
+ "reqv" => "http://purl.org/rss/1.0/modules/richequiv/",
67
+ "search" => "http://purl.org/rss/1.0/modules/search/",
68
+ "slash" => "http://purl.org/rss/1.0/modules/slash/",
69
+ "soap" => "http://schemas.xmlsoap.org/soap/envelope/",
70
+ "ss" => "http://purl.org/rss/1.0/modules/servicestatus/",
71
+ "str" => "http://hacks.benhammersley.com/rss/streaming/",
72
+ "sub" => "http://purl.org/rss/1.0/modules/subscription/",
73
+ "sy" => "http://purl.org/rss/1.0/modules/syndication/",
74
+ "taxo" => "http://purl.org/rss/1.0/modules/taxonomy/",
75
+ "thr" => "http://purl.org/rss/1.0/modules/threading/",
76
+ "ti" => "http://purl.org/rss/1.0/modules/textinput/",
77
+ "trackback" => "http://madskills.com/public/xml/rss/module/trackback/",
78
+ "wfw" => "http://wellformedweb.org/CommentAPI/",
79
+ "wiki" => "http://purl.org/rss/1.0/modules/wiki/",
80
+ "xhtml" => "http://www.w3.org/1999/xhtml",
81
+ "xml" => "http://www.w3.org/XML/1998/namespace"
82
+ }
36
83
 
37
84
  $:.unshift(File.dirname(__FILE__))
38
85
  $:.unshift(File.dirname(__FILE__) + "/feed_tools/vendor")
@@ -424,7 +471,7 @@ module FeedTools
424
471
  end
425
472
 
426
473
  # Tidys up the html
427
- def FeedTools.tidy_html(html)
474
+ def FeedTools.tidy_html(html, options = {})
428
475
  return nil if html.nil?
429
476
  if FeedTools.tidy_enabled?
430
477
  is_fragment = true
@@ -438,9 +485,15 @@ module FeedTools
438
485
  end
439
486
  tidy_html = Tidy.open(:show_warnings=>false) do |tidy|
440
487
  tidy.options.output_xml = true
488
+ tidy.options.numeric_entities = true
489
+ tidy.options.markup = true
441
490
  tidy.options.indent = false
442
491
  tidy.options.wrap_attributes = true
443
492
  tidy.options.logical_emphasis = true
493
+ # TODO: Make this match the actual encoding of the feed
494
+ # =====================================================
495
+ tidy.options.char_encoding = "utf8"
496
+ tidy.options.ascii_chars = true
444
497
  tidy.options.doctype = "omit"
445
498
  xml = tidy.clean(html)
446
499
  xml
@@ -750,8 +750,9 @@ module FeedTools
750
750
  unless @title.nil?
751
751
  @title = FeedTools.sanitize_html(@title, :strip)
752
752
  @title = FeedTools.unescape_entities(@title) if repair_entities
753
- @title = FeedTools.tidy_html(@title)
753
+ @title = FeedTools.tidy_html(@title) unless repair_entities
754
754
  end
755
+ @title.gsub!(/>\n</, "><")
755
756
  @title.gsub!(/\n/, " ")
756
757
  @title.strip!
757
758
  @title = nil if @title == ""
@@ -792,19 +793,25 @@ module FeedTools
792
793
  end
793
794
  if description_node.nil?
794
795
  description_node = XPath.first(channel_node, "content:encoded")
795
- @bozo = true unless description_node.nil?
796
+ end
797
+ if description_node.nil?
798
+ description_node = XPath.first(channel_node, "content:encoded",
799
+ FEED_TOOLS_NAMESPACES)
800
+ end
801
+ if description_node.nil?
802
+ description_node = XPath.first(root_node, "encoded")
796
803
  end
797
804
  if description_node.nil?
798
805
  description_node = XPath.first(channel_node, "content")
799
- @bozo = true unless description_node.nil?
800
806
  end
801
807
  if description_node.nil?
802
808
  description_node = XPath.first(channel_node, "xhtml:body")
803
- @bozo = true unless description_node.nil?
804
809
  end
805
810
  if description_node.nil?
806
811
  description_node = XPath.first(channel_node, "body")
807
- @bozo = true unless description_node.nil?
812
+ end
813
+ if description_node.nil?
814
+ description_node = XPath.first(channel_node, "blurb")
808
815
  end
809
816
  end
810
817
  if description_node.nil?
@@ -814,6 +821,8 @@ module FeedTools
814
821
  if XPath.first(description_node, "@encoding").to_s != ""
815
822
  @description =
816
823
  "[Embedded data objects are not currently supported.]"
824
+ elsif description_node.cdatas.size > 0
825
+ @description = description_node.cdatas.first.value
817
826
  elsif XPath.first(description_node, "@type").to_s == "xhtml" ||
818
827
  XPath.first(description_node, "@mode").to_s == "xhtml" ||
819
828
  XPath.first(description_node, "@type").to_s == "xml" ||
@@ -842,7 +851,7 @@ module FeedTools
842
851
  unless @description.nil?
843
852
  @description = FeedTools.sanitize_html(@description, :strip)
844
853
  @description = FeedTools.unescape_entities(@description) if repair_entities
845
- @description = FeedTools.tidy_html(@description)
854
+ @description = FeedTools.tidy_html(@description) unless repair_entities
846
855
  end
847
856
 
848
857
  @description = @description.strip unless @description.nil?
@@ -1193,13 +1202,13 @@ module FeedTools
1193
1202
  #
1194
1203
  # Returns any incorrectly placed channel-level itunes:author
1195
1204
  # elements. They're actually amazingly common. People don't read specs.
1196
- # There is no setter for this, since this is a "bozo" attribute.
1205
+ # There is no setter for this, since this is an incorrectly placed
1206
+ # attribute.
1197
1207
  def itunes_author
1198
1208
  if @itunes_author.nil?
1199
1209
  @itunes_author = FeedTools.unescape_entities(XPath.first(channel_node,
1200
1210
  "itunes:author/text()").to_s)
1201
1211
  @itunes_author = nil if @itunes_author == ""
1202
- @bozo = true unless @itunes_author.nil?
1203
1212
  end
1204
1213
  return @itunes_author
1205
1214
  end
@@ -1776,14 +1785,6 @@ module FeedTools
1776
1785
  return vidlog
1777
1786
  end
1778
1787
 
1779
- # True if this feed is malformed somehow
1780
- def bozo?
1781
- if @bozo.nil?
1782
- @bozo = false
1783
- end
1784
- return @bozo
1785
- end
1786
-
1787
1788
  # True if the feed was not last retrieved from the cache.
1788
1789
  def live?
1789
1790
  return @live
@@ -223,6 +223,9 @@ module FeedTools
223
223
  unless root_node.nil?
224
224
  repair_entities = false
225
225
  title_node = XPath.first(root_node, "title")
226
+ if title_node.nil?
227
+ title_node = XPath.first(root_node, "atom:title")
228
+ end
226
229
  if title_node.nil?
227
230
  title_node = XPath.first(root_node, "dc:title")
228
231
  end
@@ -250,7 +253,7 @@ module FeedTools
250
253
  unless @title.nil?
251
254
  @title = FeedTools.sanitize_html(@title, :strip)
252
255
  @title = FeedTools.unescape_entities(@title) if repair_entities
253
- @title = FeedTools.tidy_html(@title)
256
+ @title = FeedTools.tidy_html(@title) unless repair_entities
254
257
  end
255
258
  if @title != ""
256
259
  # Some blogging tools include the number of comments in a post
@@ -262,6 +265,7 @@ module FeedTools
262
265
  # unstripped title, just use find_node("title/text()").to_s
263
266
  @title = @title.strip.gsub(/\[\d*\]$/, "").strip
264
267
  end
268
+ @title.gsub!(/>\n</, "><")
265
269
  @title.gsub!(/\n/, " ")
266
270
  @title.strip!
267
271
  @title = nil if @title == ""
@@ -280,6 +284,13 @@ module FeedTools
280
284
  unless root_node.nil?
281
285
  repair_entities = false
282
286
  description_node = XPath.first(root_node, "content:encoded")
287
+ if description_node.nil?
288
+ description_node = XPath.first(root_node, "content:encoded",
289
+ FEED_TOOLS_NAMESPACES)
290
+ end
291
+ if description_node.nil?
292
+ description_node = XPath.first(root_node, "encoded")
293
+ end
283
294
  if description_node.nil?
284
295
  description_node = XPath.first(root_node, "content")
285
296
  end
@@ -289,6 +300,10 @@ module FeedTools
289
300
  if description_node.nil?
290
301
  description_node = XPath.first(root_node, "xhtml:body")
291
302
  end
303
+ if description_node.nil?
304
+ description_node = XPath.first(root_node, "xhtml:body",
305
+ FEED_TOOLS_NAMESPACES)
306
+ end
292
307
  if description_node.nil?
293
308
  description_node = XPath.first(root_node, "body")
294
309
  end
@@ -310,9 +325,11 @@ module FeedTools
310
325
  if description_node.nil?
311
326
  description_node = XPath.first(root_node, "ABSTRACT")
312
327
  end
328
+ if description_node.nil?
329
+ description_node = XPath.first(root_node, "blurb")
330
+ end
313
331
  if description_node.nil?
314
332
  description_node = XPath.first(root_node, "info")
315
- @bozo = true unless description_node.nil?
316
333
  end
317
334
  end
318
335
  if description_node.nil?
@@ -322,6 +339,8 @@ module FeedTools
322
339
  if XPath.first(description_node, "@encoding").to_s != ""
323
340
  @description =
324
341
  "[Embedded data objects are not currently supported.]"
342
+ elsif description_node.cdatas.size > 0
343
+ @description = description_node.cdatas.first.value
325
344
  elsif XPath.first(description_node, "@type").to_s == "xhtml" ||
326
345
  XPath.first(description_node, "@mode").to_s == "xhtml" ||
327
346
  XPath.first(description_node, "@type").to_s == "xml" ||
@@ -350,7 +369,7 @@ module FeedTools
350
369
  unless @description.nil?
351
370
  @description = FeedTools.sanitize_html(@description, :strip)
352
371
  @description = FeedTools.unescape_entities(@description) if repair_entities
353
- @description = FeedTools.tidy_html(@description)
372
+ @description = FeedTools.tidy_html(@description) unless repair_entities
354
373
  end
355
374
 
356
375
  @description = @description.strip unless @description.nil?
@@ -533,9 +552,6 @@ module FeedTools
533
552
  for image_node in image_nodes
534
553
  image = FeedTools::Feed::Image.new
535
554
  image.url = XPath.first(image_node, "url/text()").to_s
536
- if image.url != ""
537
- self.feed.bozo = true
538
- end
539
555
  if image.url == ""
540
556
  image.url = XPath.first(image_node, "@rdf:resource").to_s
541
557
  end
data/rakefile CHANGED
@@ -7,7 +7,7 @@ require 'rake/gempackagetask'
7
7
  require 'rake/contrib/rubyforgepublisher'
8
8
 
9
9
  PKG_NAME = 'feedtools'
10
- PKG_VERSION = '0.2.14'
10
+ PKG_VERSION = '0.2.15'
11
11
  PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
12
12
 
13
13
  RELEASE_NAME = "REL #{PKG_VERSION}"
data/test/amp_test.rb CHANGED
@@ -10,448 +10,384 @@ class AmpTest < Test::Unit::TestCase
10
10
  feed = FeedTools::Feed.open(
11
11
  'http://feedparser.org/tests/wellformed/amp/amp01.xml')
12
12
  assert_equal("&amp;", feed.entries.first.title)
13
- assert_equal(false, feed.bozo?)
14
13
  end
15
14
 
16
15
  def test_amp_02
17
16
  feed = FeedTools::Feed.open(
18
17
  'http://feedparser.org/tests/wellformed/amp/amp02.xml')
19
18
  assert_equal("&amp;", feed.entries.first.title)
20
- assert_equal(false, feed.bozo?)
21
19
  end
22
20
 
23
21
  def test_amp_03
24
22
  feed = FeedTools::Feed.open(
25
23
  'http://feedparser.org/tests/wellformed/amp/amp03.xml')
26
24
  assert_equal("&", feed.entries.first.title)
27
- assert_equal(false, feed.bozo?)
28
25
  end
29
26
 
30
27
  def test_amp_04
31
28
  feed = FeedTools::Feed.open(
32
29
  'http://feedparser.org/tests/wellformed/amp/amp04.xml')
33
30
  assert_equal("&amp;", feed.entries.first.title)
34
- assert_equal(false, feed.bozo?)
35
31
  end
36
32
 
37
33
  def test_amp_05
38
34
  feed = FeedTools::Feed.open(
39
35
  'http://feedparser.org/tests/wellformed/amp/amp05.xml')
40
36
  assert_equal("&amp;", feed.entries.first.title)
41
- assert_equal(false, feed.bozo?)
42
37
  end
43
38
 
44
39
  def test_amp_06
45
40
  feed = FeedTools::Feed.open(
46
41
  'http://feedparser.org/tests/wellformed/amp/amp06.xml')
47
42
  assert_equal("&amp;", feed.entries.first.title)
48
- assert_equal(false, feed.bozo?)
49
43
  end
50
44
 
51
45
  def test_amp_07
52
46
  feed = FeedTools::Feed.open(
53
47
  'http://feedparser.org/tests/wellformed/amp/amp07.xml')
54
48
  assert_equal("&", feed.entries.first.title)
55
- assert_equal(false, feed.bozo?)
56
49
  end
57
50
 
58
51
  def test_amp_08
59
52
  feed = FeedTools::Feed.open(
60
53
  'http://feedparser.org/tests/wellformed/amp/amp08.xml')
61
54
  assert_equal("&amp;", feed.entries.first.title)
62
- assert_equal(false, feed.bozo?)
63
55
  end
64
56
 
65
57
  def test_amp_09
66
58
  feed = FeedTools::Feed.open(
67
59
  'http://feedparser.org/tests/wellformed/amp/amp09.xml')
68
60
  assert_equal("&amp;", feed.entries.first.title)
69
- assert_equal(false, feed.bozo?)
70
61
  end
71
62
 
72
63
  def test_amp_10
73
64
  feed = FeedTools::Feed.open(
74
65
  'http://feedparser.org/tests/wellformed/amp/amp10.xml')
75
66
  assert_equal("&amp;", feed.entries.first.title)
76
- assert_equal(false, feed.bozo?)
77
67
  end
78
68
 
79
69
  def test_amp_11
80
70
  feed = FeedTools::Feed.open(
81
71
  'http://feedparser.org/tests/wellformed/amp/amp11.xml')
82
72
  assert_equal("&", feed.entries.first.title)
83
- assert_equal(false, feed.bozo?)
84
73
  end
85
74
 
86
75
  def test_amp_12
87
76
  feed = FeedTools::Feed.open(
88
77
  'http://feedparser.org/tests/wellformed/amp/amp12.xml')
89
78
  assert_equal("&amp;", feed.entries.first.title)
90
- assert_equal(false, feed.bozo?)
91
79
  end
92
80
 
93
81
  def test_amp_13
94
82
  feed = FeedTools::Feed.open(
95
83
  'http://feedparser.org/tests/wellformed/amp/amp13.xml')
96
84
  assert_equal("<b>&amp;</b>", feed.entries.first.title)
97
- assert_equal(false, feed.bozo?)
98
85
  end
99
86
 
100
87
  def test_amp_14
101
88
  feed = FeedTools::Feed.open(
102
89
  'http://feedparser.org/tests/wellformed/amp/amp14.xml')
103
90
  assert_equal("<b>&amp;</b>", feed.entries.first.title)
104
- assert_equal(false, feed.bozo?)
105
91
  end
106
92
 
107
93
  def test_amp_15
108
94
  feed = FeedTools::Feed.open(
109
95
  'http://feedparser.org/tests/wellformed/amp/amp15.xml')
110
96
  assert_equal("<b>&amp;</b>", feed.entries.first.title)
111
- assert_equal(false, feed.bozo?)
112
97
  end
113
98
 
114
99
  def test_amp_16
115
100
  feed = FeedTools::Feed.open(
116
101
  'http://feedparser.org/tests/wellformed/amp/amp16.xml')
117
102
  assert_equal("<b>&amp;</b>", feed.entries.first.title)
118
- assert_equal(false, feed.bozo?)
119
103
  end
120
104
 
121
105
  def test_amp_17
122
106
  feed = FeedTools::Feed.open(
123
107
  'http://feedparser.org/tests/wellformed/amp/amp17.xml')
124
108
  assert_equal("<b>&amp;</b>", feed.entries.first.title)
125
- assert_equal(false, feed.bozo?)
126
109
  end
127
110
 
128
111
  def test_amp_18
129
112
  feed = FeedTools::Feed.open(
130
113
  'http://feedparser.org/tests/wellformed/amp/amp18.xml')
131
114
  assert_equal("<b>&amp;</b>", feed.entries.first.title)
132
- assert_equal(false, feed.bozo?)
133
115
  end
134
116
 
135
117
  def test_amp_19
136
118
  feed = FeedTools::Feed.open(
137
119
  'http://feedparser.org/tests/wellformed/amp/amp19.xml')
138
120
  assert_equal("<b>&amp;</b>", feed.entries.first.title)
139
- assert_equal(false, feed.bozo?)
140
121
  end
141
122
 
142
123
  def test_amp_20
143
124
  feed = FeedTools::Feed.open(
144
125
  'http://feedparser.org/tests/wellformed/amp/amp20.xml')
145
126
  assert_equal("<b>&amp;</b>", feed.entries.first.title)
146
- assert_equal(false, feed.bozo?)
147
127
  end
148
128
 
149
129
  def test_amp_21
150
130
  feed = FeedTools::Feed.open(
151
131
  'http://feedparser.org/tests/wellformed/amp/amp21.xml')
152
132
  assert_equal("<b>&amp;</b>", feed.entries.first.title)
153
- assert_equal(false, feed.bozo?)
154
133
  end
155
134
 
156
135
  def test_amp_22
157
136
  feed = FeedTools::Feed.open(
158
137
  'http://feedparser.org/tests/wellformed/amp/amp22.xml')
159
138
  assert_equal("<b>&amp;</b>", feed.entries.first.title)
160
- assert_equal(false, feed.bozo?)
161
139
  end
162
140
 
163
141
  def test_amp_23
164
142
  feed = FeedTools::Feed.open(
165
143
  'http://feedparser.org/tests/wellformed/amp/amp23.xml')
166
144
  assert_equal("<b>&amp;</b>", feed.entries.first.title)
167
- assert_equal(false, feed.bozo?)
168
145
  end
169
146
 
170
147
  def test_amp_24
171
148
  feed = FeedTools::Feed.open(
172
149
  'http://feedparser.org/tests/wellformed/amp/amp24.xml')
173
150
  assert_equal("<b>&amp;</b>", feed.entries.first.title)
174
- assert_equal(false, feed.bozo?)
175
151
  end
176
152
 
177
153
  def test_amp_25
178
154
  feed = FeedTools::Feed.open(
179
155
  'http://feedparser.org/tests/wellformed/amp/amp25.xml')
180
156
  assert_equal("<b>&amp;</b>", feed.entries.first.title)
181
- assert_equal(false, feed.bozo?)
182
157
  end
183
158
 
184
159
  def test_amp_26
185
160
  feed = FeedTools::Feed.open(
186
161
  'http://feedparser.org/tests/wellformed/amp/amp26.xml')
187
162
  assert_equal("<b>&amp;</b>", feed.entries.first.title)
188
- assert_equal(false, feed.bozo?)
189
163
  end
190
164
 
191
165
  def test_amp_27
192
166
  feed = FeedTools::Feed.open(
193
167
  'http://feedparser.org/tests/wellformed/amp/amp27.xml')
194
168
  assert_equal("<b>&amp;</b>", feed.entries.first.title)
195
- assert_equal(false, feed.bozo?)
196
169
  end
197
170
 
198
171
  def test_amp_28
199
172
  feed = FeedTools::Feed.open(
200
173
  'http://feedparser.org/tests/wellformed/amp/amp28.xml')
201
174
  assert_equal("<b>&amp;</b>", feed.entries.first.title)
202
- assert_equal(false, feed.bozo?)
203
175
  end
204
176
 
205
177
  def test_amp_29
206
178
  feed = FeedTools::Feed.open(
207
179
  'http://feedparser.org/tests/wellformed/amp/amp29.xml')
208
180
  assert_equal("<b>&amp;</b>", feed.entries.first.title)
209
- assert_equal(false, feed.bozo?)
210
181
  end
211
182
 
212
183
  def test_amp_30
213
184
  feed = FeedTools::Feed.open(
214
185
  'http://feedparser.org/tests/wellformed/amp/amp30.xml')
215
186
  assert_equal("<b>&amp;</b>", feed.entries.first.title)
216
- assert_equal(false, feed.bozo?)
217
187
  end
218
188
 
219
189
  def test_amp_31
220
190
  feed = FeedTools::Feed.open(
221
191
  'http://feedparser.org/tests/wellformed/amp/amp31.xml')
222
192
  assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
223
- assert_equal(false, feed.bozo?)
224
193
  end
225
194
 
226
195
  def test_amp_32
227
196
  feed = FeedTools::Feed.open(
228
197
  'http://feedparser.org/tests/wellformed/amp/amp32.xml')
229
198
  assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
230
- assert_equal(false, feed.bozo?)
231
199
  end
232
200
 
233
201
  def test_amp_33
234
202
  feed = FeedTools::Feed.open(
235
203
  'http://feedparser.org/tests/wellformed/amp/amp33.xml')
236
204
  assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
237
- assert_equal(false, feed.bozo?)
238
205
  end
239
206
 
240
207
  def test_amp_34
241
208
  feed = FeedTools::Feed.open(
242
209
  'http://feedparser.org/tests/wellformed/amp/amp34.xml')
243
210
  assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
244
- assert_equal(false, feed.bozo?)
245
211
  end
246
212
 
247
213
  def test_amp_35
248
214
  feed = FeedTools::Feed.open(
249
215
  'http://feedparser.org/tests/wellformed/amp/amp35.xml')
250
216
  assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
251
- assert_equal(false, feed.bozo?)
252
217
  end
253
218
 
254
219
  def test_amp_36
255
220
  feed = FeedTools::Feed.open(
256
221
  'http://feedparser.org/tests/wellformed/amp/amp36.xml')
257
222
  assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
258
- assert_equal(false, feed.bozo?)
259
223
  end
260
224
 
261
225
  def test_amp_37
262
226
  feed = FeedTools::Feed.open(
263
227
  'http://feedparser.org/tests/wellformed/amp/amp37.xml')
264
228
  assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
265
- assert_equal(false, feed.bozo?)
266
229
  end
267
230
 
268
231
  def test_amp_38
269
232
  feed = FeedTools::Feed.open(
270
233
  'http://feedparser.org/tests/wellformed/amp/amp38.xml')
271
234
  assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
272
- assert_equal(false, feed.bozo?)
273
235
  end
274
236
 
275
237
  def test_amp_39
276
238
  feed = FeedTools::Feed.open(
277
239
  'http://feedparser.org/tests/wellformed/amp/amp39.xml')
278
240
  assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
279
- assert_equal(false, feed.bozo?)
280
241
  end
281
242
 
282
243
  def test_amp_40
283
244
  feed = FeedTools::Feed.open(
284
245
  'http://feedparser.org/tests/wellformed/amp/amp40.xml')
285
246
  assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
286
- assert_equal(false, feed.bozo?)
287
247
  end
288
248
 
289
249
  def test_amp_41
290
250
  feed = FeedTools::Feed.open(
291
251
  'http://feedparser.org/tests/wellformed/amp/amp41.xml')
292
252
  assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
293
- assert_equal(false, feed.bozo?)
294
253
  end
295
254
 
296
255
  def test_amp_42
297
256
  feed = FeedTools::Feed.open(
298
257
  'http://feedparser.org/tests/wellformed/amp/amp42.xml')
299
258
  assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
300
- assert_equal(false, feed.bozo?)
301
259
  end
302
260
 
303
261
  def test_amp_43
304
262
  feed = FeedTools::Feed.open(
305
263
  'http://feedparser.org/tests/wellformed/amp/amp43.xml')
306
264
  assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
307
- assert_equal(false, feed.bozo?)
308
265
  end
309
266
 
310
267
  def test_amp_44
311
268
  feed = FeedTools::Feed.open(
312
269
  'http://feedparser.org/tests/wellformed/amp/amp44.xml')
313
270
  assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
314
- assert_equal(false, feed.bozo?)
315
271
  end
316
272
 
317
273
  def test_amp_45
318
274
  feed = FeedTools::Feed.open(
319
275
  'http://feedparser.org/tests/wellformed/amp/amp45.xml')
320
276
  assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
321
- assert_equal(false, feed.bozo?)
322
277
  end
323
278
 
324
279
  def test_amp_46
325
280
  feed = FeedTools::Feed.open(
326
281
  'http://feedparser.org/tests/wellformed/amp/amp46.xml')
327
282
  assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
328
- assert_equal(false, feed.bozo?)
329
283
  end
330
284
 
331
285
  def test_amp_47
332
286
  feed = FeedTools::Feed.open(
333
287
  'http://feedparser.org/tests/wellformed/amp/amp47.xml')
334
288
  assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
335
- assert_equal(false, feed.bozo?)
336
289
  end
337
290
 
338
291
  def test_amp_48
339
292
  feed = FeedTools::Feed.open(
340
293
  'http://feedparser.org/tests/wellformed/amp/amp48.xml')
341
294
  assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
342
- assert_equal(false, feed.bozo?)
343
295
  end
344
296
 
345
297
  def test_amp_49
346
298
  feed = FeedTools::Feed.open(
347
299
  'http://feedparser.org/tests/wellformed/amp/amp49.xml')
348
300
  assert_equal("&amp;", feed.entries.first.title)
349
- assert_equal(false, feed.bozo?)
350
301
  end
351
302
 
352
303
  def test_amp_50
353
304
  feed = FeedTools::Feed.open(
354
305
  'http://feedparser.org/tests/wellformed/amp/amp50.xml')
355
306
  assert_equal("&amp;", feed.entries.first.title)
356
- assert_equal(false, feed.bozo?)
357
307
  end
358
308
 
359
309
  def test_amp_51
360
310
  feed = FeedTools::Feed.open(
361
311
  'http://feedparser.org/tests/wellformed/amp/amp51.xml')
362
312
  assert_equal("&", feed.entries.first.title)
363
- assert_equal(false, feed.bozo?)
364
313
  end
365
314
 
366
315
  def test_amp_52
367
316
  feed = FeedTools::Feed.open(
368
317
  'http://feedparser.org/tests/wellformed/amp/amp52.xml')
369
318
  assert_equal("&amp;", feed.entries.first.title)
370
- assert_equal(false, feed.bozo?)
371
319
  end
372
320
 
373
321
  def test_amp_53
374
322
  feed = FeedTools::Feed.open(
375
323
  'http://feedparser.org/tests/wellformed/amp/amp53.xml')
376
324
  assert_equal("<b>&amp;</b>", feed.entries.first.title)
377
- assert_equal(false, feed.bozo?)
378
325
  end
379
326
 
380
327
  def test_amp_54
381
328
  feed = FeedTools::Feed.open(
382
329
  'http://feedparser.org/tests/wellformed/amp/amp54.xml')
383
330
  assert_equal("<b>&amp;</b>", feed.entries.first.title)
384
- assert_equal(false, feed.bozo?)
385
331
  end
386
332
 
387
333
  def test_amp_55
388
334
  feed = FeedTools::Feed.open(
389
335
  'http://feedparser.org/tests/wellformed/amp/amp55.xml')
390
336
  assert_equal("<b>&amp;</b>", feed.entries.first.title)
391
- assert_equal(false, feed.bozo?)
392
337
  end
393
338
 
394
339
  def test_amp_56
395
340
  feed = FeedTools::Feed.open(
396
341
  'http://feedparser.org/tests/wellformed/amp/amp56.xml')
397
342
  assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
398
- assert_equal(false, feed.bozo?)
399
343
  end
400
344
 
401
345
  def test_amp_57
402
346
  feed = FeedTools::Feed.open(
403
347
  'http://feedparser.org/tests/wellformed/amp/amp57.xml')
404
348
  assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
405
- assert_equal(false, feed.bozo?)
406
349
  end
407
350
 
408
351
  def test_amp_58
409
352
  feed = FeedTools::Feed.open(
410
353
  'http://feedparser.org/tests/wellformed/amp/amp58.xml')
411
354
  assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
412
- assert_equal(false, feed.bozo?)
413
355
  end
414
356
 
415
357
  def test_amp_59
416
358
  feed = FeedTools::Feed.open(
417
359
  'http://feedparser.org/tests/wellformed/amp/amp59.xml')
418
360
  assert_equal("<div><b>&amp;</b></div>", feed.entries.first.title)
419
- assert_equal(false, feed.bozo?)
420
361
  end
421
362
 
422
363
  def test_amp_60
423
364
  feed = FeedTools::Feed.open(
424
365
  'http://feedparser.org/tests/wellformed/amp/amp60.xml')
425
366
  assert_equal("<div><b>&amp;</b></div>", feed.entries.first.title)
426
- assert_equal(false, feed.bozo?)
427
367
  end
428
368
 
429
369
  def test_amp_61
430
370
  feed = FeedTools::Feed.open(
431
371
  'http://feedparser.org/tests/wellformed/amp/amp61.xml')
432
372
  assert_equal("<div><b>&amp;</b></div>", feed.entries.first.title)
433
- assert_equal(false, feed.bozo?)
434
373
  end
435
374
 
436
375
  def test_amp_62
437
376
  feed = FeedTools::Feed.open(
438
377
  'http://feedparser.org/tests/wellformed/amp/amp62.xml')
439
378
  assert_equal("<div><strong>&amp;</strong></div>", feed.entries.first.title)
440
- assert_equal(false, feed.bozo?)
441
379
  end
442
380
 
443
381
  def test_amp_63
444
382
  feed = FeedTools::Feed.open(
445
383
  'http://feedparser.org/tests/wellformed/amp/amp63.xml')
446
384
  assert_equal("<div><strong>&amp;</strong></div>", feed.entries.first.title)
447
- assert_equal(false, feed.bozo?)
448
385
  end
449
386
 
450
387
  def test_amp_64
451
388
  feed = FeedTools::Feed.open(
452
389
  'http://feedparser.org/tests/wellformed/amp/amp64.xml')
453
390
  assert_equal("<div><strong>&amp;</strong></div>", feed.entries.first.title)
454
- assert_equal(false, feed.bozo?)
455
391
  end
456
392
 
457
393
  def test_amp_65
@@ -470,6 +406,472 @@ class AmpTest < Test::Unit::TestCase
470
406
  assert_equal("<strong>1 &amp; 2 & 3</strong>", feed.tagline)
471
407
  assert_equal("<strong>1 &amp; 2 & 3</strong>", feed.entries.first.title)
472
408
  assert_equal("<strong>1 &amp; 2 & 3</strong>", feed.entries.first.content)
473
- assert_equal(false, feed.bozo?)
409
+ end
410
+
411
+ def test_amp_tidy_01
412
+ FeedTools.tidy_enabled = true
413
+ feed = FeedTools::Feed.open(
414
+ 'http://feedparser.org/tests/wellformed/amp/amp01.xml')
415
+ assert_equal("&amp;", feed.entries.first.title)
416
+ end
417
+
418
+ def test_amp_tidy_02
419
+ FeedTools.tidy_enabled = true
420
+ feed = FeedTools::Feed.open(
421
+ 'http://feedparser.org/tests/wellformed/amp/amp02.xml')
422
+ assert_equal("&amp;", feed.entries.first.title)
423
+ end
424
+
425
+ def test_amp_tidy_03
426
+ FeedTools.tidy_enabled = true
427
+ feed = FeedTools::Feed.open(
428
+ 'http://feedparser.org/tests/wellformed/amp/amp03.xml')
429
+ assert_equal("&", feed.entries.first.title)
430
+ end
431
+
432
+ def test_amp_tidy_04
433
+ FeedTools.tidy_enabled = true
434
+ feed = FeedTools::Feed.open(
435
+ 'http://feedparser.org/tests/wellformed/amp/amp04.xml')
436
+ assert_equal("&amp;", feed.entries.first.title)
437
+ end
438
+
439
+ def test_amp_tidy_05
440
+ FeedTools.tidy_enabled = true
441
+ feed = FeedTools::Feed.open(
442
+ 'http://feedparser.org/tests/wellformed/amp/amp05.xml')
443
+ assert_equal("&amp;", feed.entries.first.title)
444
+ end
445
+
446
+ def test_amp_tidy_06
447
+ FeedTools.tidy_enabled = true
448
+ feed = FeedTools::Feed.open(
449
+ 'http://feedparser.org/tests/wellformed/amp/amp06.xml')
450
+ assert_equal("&amp;", feed.entries.first.title)
451
+ end
452
+
453
+ def test_amp_tidy_07
454
+ FeedTools.tidy_enabled = true
455
+ feed = FeedTools::Feed.open(
456
+ 'http://feedparser.org/tests/wellformed/amp/amp07.xml')
457
+ assert_equal("&", feed.entries.first.title)
458
+ end
459
+
460
+ def test_amp_tidy_08
461
+ FeedTools.tidy_enabled = true
462
+ feed = FeedTools::Feed.open(
463
+ 'http://feedparser.org/tests/wellformed/amp/amp08.xml')
464
+ assert_equal("&amp;", feed.entries.first.title)
465
+ end
466
+
467
+ def test_amp_tidy_09
468
+ FeedTools.tidy_enabled = true
469
+ feed = FeedTools::Feed.open(
470
+ 'http://feedparser.org/tests/wellformed/amp/amp09.xml')
471
+ assert_equal("&amp;", feed.entries.first.title)
472
+ end
473
+
474
+ def test_amp_tidy_10
475
+ FeedTools.tidy_enabled = true
476
+ feed = FeedTools::Feed.open(
477
+ 'http://feedparser.org/tests/wellformed/amp/amp10.xml')
478
+ assert_equal("&amp;", feed.entries.first.title)
479
+ end
480
+
481
+ def test_amp_tidy_11
482
+ FeedTools.tidy_enabled = true
483
+ feed = FeedTools::Feed.open(
484
+ 'http://feedparser.org/tests/wellformed/amp/amp11.xml')
485
+ assert_equal("&", feed.entries.first.title)
486
+ end
487
+
488
+ def test_amp_tidy_12
489
+ FeedTools.tidy_enabled = true
490
+ feed = FeedTools::Feed.open(
491
+ 'http://feedparser.org/tests/wellformed/amp/amp12.xml')
492
+ assert_equal("&amp;", feed.entries.first.title)
493
+ end
494
+
495
+ def test_amp_tidy_13
496
+ FeedTools.tidy_enabled = true
497
+ feed = FeedTools::Feed.open(
498
+ 'http://feedparser.org/tests/wellformed/amp/amp13.xml')
499
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
500
+ end
501
+
502
+ def test_amp_tidy_14
503
+ FeedTools.tidy_enabled = true
504
+ feed = FeedTools::Feed.open(
505
+ 'http://feedparser.org/tests/wellformed/amp/amp14.xml')
506
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
507
+ end
508
+
509
+ def test_amp_tidy_15
510
+ FeedTools.tidy_enabled = true
511
+ feed = FeedTools::Feed.open(
512
+ 'http://feedparser.org/tests/wellformed/amp/amp15.xml')
513
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
514
+ end
515
+
516
+ def test_amp_tidy_16
517
+ FeedTools.tidy_enabled = true
518
+ feed = FeedTools::Feed.open(
519
+ 'http://feedparser.org/tests/wellformed/amp/amp16.xml')
520
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
521
+ end
522
+
523
+ def test_amp_tidy_17
524
+ FeedTools.tidy_enabled = true
525
+ feed = FeedTools::Feed.open(
526
+ 'http://feedparser.org/tests/wellformed/amp/amp17.xml')
527
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
528
+ end
529
+
530
+ def test_amp_tidy_18
531
+ FeedTools.tidy_enabled = true
532
+ feed = FeedTools::Feed.open(
533
+ 'http://feedparser.org/tests/wellformed/amp/amp18.xml')
534
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
535
+ end
536
+
537
+ def test_amp_tidy_19
538
+ FeedTools.tidy_enabled = true
539
+ feed = FeedTools::Feed.open(
540
+ 'http://feedparser.org/tests/wellformed/amp/amp19.xml')
541
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
542
+ end
543
+
544
+ def test_amp_tidy_20
545
+ FeedTools.tidy_enabled = true
546
+ feed = FeedTools::Feed.open(
547
+ 'http://feedparser.org/tests/wellformed/amp/amp20.xml')
548
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
549
+ end
550
+
551
+ def test_amp_tidy_21
552
+ FeedTools.tidy_enabled = true
553
+ feed = FeedTools::Feed.open(
554
+ 'http://feedparser.org/tests/wellformed/amp/amp21.xml')
555
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
556
+ end
557
+
558
+ def test_amp_tidy_22
559
+ FeedTools.tidy_enabled = true
560
+ feed = FeedTools::Feed.open(
561
+ 'http://feedparser.org/tests/wellformed/amp/amp22.xml')
562
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
563
+ end
564
+
565
+ def test_amp_tidy_23
566
+ FeedTools.tidy_enabled = true
567
+ feed = FeedTools::Feed.open(
568
+ 'http://feedparser.org/tests/wellformed/amp/amp23.xml')
569
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
570
+ end
571
+
572
+ def test_amp_tidy_24
573
+ FeedTools.tidy_enabled = true
574
+ feed = FeedTools::Feed.open(
575
+ 'http://feedparser.org/tests/wellformed/amp/amp24.xml')
576
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
577
+ end
578
+
579
+ def test_amp_tidy_25
580
+ FeedTools.tidy_enabled = true
581
+ feed = FeedTools::Feed.open(
582
+ 'http://feedparser.org/tests/wellformed/amp/amp25.xml')
583
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
584
+ end
585
+
586
+ def test_amp_tidy_26
587
+ FeedTools.tidy_enabled = true
588
+ feed = FeedTools::Feed.open(
589
+ 'http://feedparser.org/tests/wellformed/amp/amp26.xml')
590
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
591
+ end
592
+
593
+ def test_amp_tidy_27
594
+ FeedTools.tidy_enabled = true
595
+ feed = FeedTools::Feed.open(
596
+ 'http://feedparser.org/tests/wellformed/amp/amp27.xml')
597
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
598
+ end
599
+
600
+ def test_amp_tidy_28
601
+ FeedTools.tidy_enabled = true
602
+ feed = FeedTools::Feed.open(
603
+ 'http://feedparser.org/tests/wellformed/amp/amp28.xml')
604
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
605
+ end
606
+
607
+ def test_amp_tidy_29
608
+ FeedTools.tidy_enabled = true
609
+ feed = FeedTools::Feed.open(
610
+ 'http://feedparser.org/tests/wellformed/amp/amp29.xml')
611
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
612
+ end
613
+
614
+ def test_amp_tidy_30
615
+ FeedTools.tidy_enabled = true
616
+ feed = FeedTools::Feed.open(
617
+ 'http://feedparser.org/tests/wellformed/amp/amp30.xml')
618
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
619
+ end
620
+
621
+ def test_amp_tidy_31
622
+ FeedTools.tidy_enabled = true
623
+ feed = FeedTools::Feed.open(
624
+ 'http://feedparser.org/tests/wellformed/amp/amp31.xml')
625
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
626
+ end
627
+
628
+ def test_amp_tidy_32
629
+ FeedTools.tidy_enabled = true
630
+ feed = FeedTools::Feed.open(
631
+ 'http://feedparser.org/tests/wellformed/amp/amp32.xml')
632
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
633
+ end
634
+
635
+ def test_amp_tidy_33
636
+ FeedTools.tidy_enabled = true
637
+ feed = FeedTools::Feed.open(
638
+ 'http://feedparser.org/tests/wellformed/amp/amp33.xml')
639
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
640
+ end
641
+
642
+ def test_amp_tidy_34
643
+ FeedTools.tidy_enabled = true
644
+ feed = FeedTools::Feed.open(
645
+ 'http://feedparser.org/tests/wellformed/amp/amp34.xml')
646
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
647
+ end
648
+
649
+ def test_amp_tidy_35
650
+ FeedTools.tidy_enabled = true
651
+ feed = FeedTools::Feed.open(
652
+ 'http://feedparser.org/tests/wellformed/amp/amp35.xml')
653
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
654
+ end
655
+
656
+ def test_amp_tidy_36
657
+ FeedTools.tidy_enabled = true
658
+ feed = FeedTools::Feed.open(
659
+ 'http://feedparser.org/tests/wellformed/amp/amp36.xml')
660
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
661
+ end
662
+
663
+ def test_amp_tidy_37
664
+ FeedTools.tidy_enabled = true
665
+ feed = FeedTools::Feed.open(
666
+ 'http://feedparser.org/tests/wellformed/amp/amp37.xml')
667
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
668
+ end
669
+
670
+ def test_amp_tidy_38
671
+ FeedTools.tidy_enabled = true
672
+ feed = FeedTools::Feed.open(
673
+ 'http://feedparser.org/tests/wellformed/amp/amp38.xml')
674
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
675
+ end
676
+
677
+ def test_amp_tidy_39
678
+ FeedTools.tidy_enabled = true
679
+ feed = FeedTools::Feed.open(
680
+ 'http://feedparser.org/tests/wellformed/amp/amp39.xml')
681
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
682
+ end
683
+
684
+ def test_amp_tidy_40
685
+ FeedTools.tidy_enabled = true
686
+ feed = FeedTools::Feed.open(
687
+ 'http://feedparser.org/tests/wellformed/amp/amp40.xml')
688
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
689
+ end
690
+
691
+ def test_amp_tidy_41
692
+ FeedTools.tidy_enabled = true
693
+ feed = FeedTools::Feed.open(
694
+ 'http://feedparser.org/tests/wellformed/amp/amp41.xml')
695
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
696
+ end
697
+
698
+ def test_amp_tidy_42
699
+ FeedTools.tidy_enabled = true
700
+ feed = FeedTools::Feed.open(
701
+ 'http://feedparser.org/tests/wellformed/amp/amp42.xml')
702
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
703
+ end
704
+
705
+ def test_amp_tidy_43
706
+ FeedTools.tidy_enabled = true
707
+ feed = FeedTools::Feed.open(
708
+ 'http://feedparser.org/tests/wellformed/amp/amp43.xml')
709
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
710
+ end
711
+
712
+ def test_amp_tidy_44
713
+ FeedTools.tidy_enabled = true
714
+ feed = FeedTools::Feed.open(
715
+ 'http://feedparser.org/tests/wellformed/amp/amp44.xml')
716
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
717
+ end
718
+
719
+ def test_amp_tidy_45
720
+ FeedTools.tidy_enabled = true
721
+ feed = FeedTools::Feed.open(
722
+ 'http://feedparser.org/tests/wellformed/amp/amp45.xml')
723
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
724
+ end
725
+
726
+ def test_amp_tidy_46
727
+ FeedTools.tidy_enabled = true
728
+ feed = FeedTools::Feed.open(
729
+ 'http://feedparser.org/tests/wellformed/amp/amp46.xml')
730
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
731
+ end
732
+
733
+ def test_amp_tidy_47
734
+ FeedTools.tidy_enabled = true
735
+ feed = FeedTools::Feed.open(
736
+ 'http://feedparser.org/tests/wellformed/amp/amp47.xml')
737
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
738
+ end
739
+
740
+ def test_amp_tidy_48
741
+ FeedTools.tidy_enabled = true
742
+ feed = FeedTools::Feed.open(
743
+ 'http://feedparser.org/tests/wellformed/amp/amp48.xml')
744
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
745
+ end
746
+
747
+ def test_amp_tidy_49
748
+ FeedTools.tidy_enabled = true
749
+ feed = FeedTools::Feed.open(
750
+ 'http://feedparser.org/tests/wellformed/amp/amp49.xml')
751
+ assert_equal("&amp;", feed.entries.first.title)
752
+ end
753
+
754
+ def test_amp_tidy_50
755
+ FeedTools.tidy_enabled = true
756
+ feed = FeedTools::Feed.open(
757
+ 'http://feedparser.org/tests/wellformed/amp/amp50.xml')
758
+ assert_equal("&amp;", feed.entries.first.title)
759
+ end
760
+
761
+ def test_amp_tidy_51
762
+ FeedTools.tidy_enabled = true
763
+ feed = FeedTools::Feed.open(
764
+ 'http://feedparser.org/tests/wellformed/amp/amp51.xml')
765
+ assert_equal("&", feed.entries.first.title)
766
+ end
767
+
768
+ def test_amp_tidy_52
769
+ FeedTools.tidy_enabled = true
770
+ feed = FeedTools::Feed.open(
771
+ 'http://feedparser.org/tests/wellformed/amp/amp52.xml')
772
+ assert_equal("&amp;", feed.entries.first.title)
773
+ end
774
+
775
+ def test_amp_tidy_53
776
+ FeedTools.tidy_enabled = true
777
+ feed = FeedTools::Feed.open(
778
+ 'http://feedparser.org/tests/wellformed/amp/amp53.xml')
779
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
780
+ end
781
+
782
+ def test_amp_tidy_54
783
+ FeedTools.tidy_enabled = true
784
+ feed = FeedTools::Feed.open(
785
+ 'http://feedparser.org/tests/wellformed/amp/amp54.xml')
786
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
787
+ end
788
+
789
+ def test_amp_tidy_55
790
+ FeedTools.tidy_enabled = true
791
+ feed = FeedTools::Feed.open(
792
+ 'http://feedparser.org/tests/wellformed/amp/amp55.xml')
793
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
794
+ end
795
+
796
+ def test_amp_tidy_56
797
+ FeedTools.tidy_enabled = true
798
+ feed = FeedTools::Feed.open(
799
+ 'http://feedparser.org/tests/wellformed/amp/amp56.xml')
800
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
801
+ end
802
+
803
+ def test_amp_tidy_57
804
+ FeedTools.tidy_enabled = true
805
+ feed = FeedTools::Feed.open(
806
+ 'http://feedparser.org/tests/wellformed/amp/amp57.xml')
807
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
808
+ end
809
+
810
+ def test_amp_tidy_58
811
+ FeedTools.tidy_enabled = true
812
+ feed = FeedTools::Feed.open(
813
+ 'http://feedparser.org/tests/wellformed/amp/amp58.xml')
814
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
815
+ end
816
+
817
+ def test_amp_tidy_59
818
+ FeedTools.tidy_enabled = true
819
+ feed = FeedTools::Feed.open(
820
+ 'http://feedparser.org/tests/wellformed/amp/amp59.xml')
821
+ assert_equal("<div><strong>&amp;</strong></div>", feed.entries.first.title)
822
+ end
823
+
824
+ def test_amp_tidy_60
825
+ FeedTools.tidy_enabled = true
826
+ feed = FeedTools::Feed.open(
827
+ 'http://feedparser.org/tests/wellformed/amp/amp60.xml')
828
+ assert_equal("<div><strong>&amp;</strong></div>", feed.entries.first.title)
829
+ end
830
+
831
+ def test_amp_tidy_61
832
+ FeedTools.tidy_enabled = true
833
+ feed = FeedTools::Feed.open(
834
+ 'http://feedparser.org/tests/wellformed/amp/amp61.xml')
835
+ assert_equal("<div><strong>&amp;</strong></div>", feed.entries.first.title)
836
+ end
837
+
838
+ def test_amp_tidy_62
839
+ FeedTools.tidy_enabled = true
840
+ feed = FeedTools::Feed.open(
841
+ 'http://feedparser.org/tests/wellformed/amp/amp62.xml')
842
+ assert_equal("<div><strong>&amp;</strong></div>", feed.entries.first.title)
843
+ end
844
+
845
+ def test_amp_tidy_63
846
+ FeedTools.tidy_enabled = true
847
+ feed = FeedTools::Feed.open(
848
+ 'http://feedparser.org/tests/wellformed/amp/amp63.xml')
849
+ assert_equal("<div><strong>&amp;</strong></div>", feed.entries.first.title)
850
+ end
851
+
852
+ def test_amp_tidy_64
853
+ FeedTools.tidy_enabled = true
854
+ feed = FeedTools::Feed.open(
855
+ 'http://feedparser.org/tests/wellformed/amp/amp64.xml')
856
+ assert_equal("<div><strong>&amp;</strong></div>", feed.entries.first.title)
857
+ end
858
+
859
+ def test_amp_tidy_65
860
+ FeedTools.tidy_enabled = true
861
+ feed = FeedTools::Feed.new
862
+ feed.feed_data = <<-FEED
863
+ <feed version="0.3">
864
+ <title>&lt;strong>1 &amp;amp; 2 &amp; 3&lt;/strong></title>
865
+ <tagline>&lt;strong>1 &amp;amp; 2 &amp; 3&lt;/strong></tagline>
866
+ <entry>
867
+ <title>&lt;strong>1 &amp;amp; 2 &amp; 3&lt;/strong></title>
868
+ <content>&lt;strong>1 &amp;amp; 2 &amp; 3&lt;/strong></content>
869
+ </entry>
870
+ </feed>
871
+ FEED
872
+ assert_equal("<strong>1 &amp; 2 & 3</strong>", feed.title)
873
+ assert_equal("<strong>1 &amp; 2 & 3</strong>", feed.tagline)
874
+ assert_equal("<strong>1 &amp; 2 & 3</strong>", feed.entries.first.title)
875
+ assert_equal("<strong>1 &amp; 2 & 3</strong>", feed.entries.first.content)
474
876
  end
475
877
  end