diff options
author | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-06-18 09:22:12 +0000 |
---|---|---|
committer | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-06-18 09:22:12 +0000 |
commit | c849d2692ba964baabf536024a24b164ca622510 (patch) | |
tree | ab54ab154fa8ec3327adc9dbbf17fe828e595539 /test | |
parent | e49a4c952cfdf32abf3d6ba946f94d152dae988d (diff) |
* lib/rss/rss.rb: improved ignore_unknown_element
handling. RSS::NotExpectedTagError provides tag URI.
* lib/rss/parser.rb: ditto.
* lib/rss/0.9.rb: ditto.
* lib/rss/1.0.rb: ditto.
* lib/rss/content.rb: ditto.
* lib/rss/dublincore.rb: ditto.
* lib/rss/image.rb: ditto.
* lib/rss/syndication.rb: ditto.
* lib/rss/taxonomy.rb: ditto.
* lib/rss/trackback.rb: ditto.
* test/rss/rss-assertions.rb: checked URI of not expected tag too.
* test/rss/test_parser.rb: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10313 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/rss/rss-assertions.rb | 3 | ||||
-rw-r--r-- | test/rss/test_parser.rb | 51 |
2 files changed, 50 insertions, 4 deletions
diff --git a/test/rss/rss-assertions.rb b/test/rss/rss-assertions.rb index fc2cd3cbed..1e926bb84d 100644 --- a/test/rss/rss-assertions.rb +++ b/test/rss/rss-assertions.rb @@ -71,13 +71,14 @@ module RSS end end - def assert_not_expected_tag(tag, parent) + def assert_not_expected_tag(tag, uri, parent) _wrap_assertion do begin yield flunk("Not raise NotExpectedTagError") rescue ::RSS::NotExpectedTagError => e assert_equal(tag, e.tag) + assert_equal(uri, e.uri) assert_equal(parent, e.parent) end end diff --git a/test/rss/test_parser.rb b/test/rss/test_parser.rb index 47bbc2d9d9..f204b88933 100644 --- a/test/rss/test_parser.rb +++ b/test/rss/test_parser.rb @@ -603,19 +603,64 @@ EOR end def test_ignore - + name = "a" rss = make_RDF(<<-EOR) #{make_channel} #{make_item} -<a/> +<#{name}/> EOR + assert_not_expected_tag(name, ::RSS::URI, "RDF") do + Parser.parse(rss, true, false) + end + uri = "" + name = "a" + rss = make_RDF(<<-EOR) +#{make_channel} +#{make_item} +<#{name} xmlns=""/> +EOR assert_parse(rss, :nothing_raised) + assert_not_expected_tag(name, uri, "RDF") do + Parser.parse(rss, true, false) + end - assert_not_expected_tag("a", "RDF") do + uri = "http://example.com/" + name = "a" + rss = make_RDF(<<-EOR) +#{make_channel} +#{make_item} +<x:#{name} xmlns:x="#{uri}"/> +EOR + assert_parse(rss, :nothing_raised) + assert_not_expected_tag(name, uri, "RDF") do Parser.parse(rss, true, false) end + uri = ::RSS::URI + name = "a" + rss = make_RDF(<<-EOR) +#{make_channel} +#{make_item} +#{make_image("<#{name}/>")} +EOR + assert_parse(rss, :nothing_raised) + assert_not_expected_tag(name, uri, "image") do + Parser.parse(rss, true, false) + end + + uri = CONTENT_URI + name = "encoded" + elem = "<#{name} xmlns='#{uri}'/>" + rss = make_RDF(<<-EOR) +#{make_channel} +#{make_item} +#{make_image(elem)} +EOR + assert_parse(rss, :nothing_raised) + assert_not_expected_tag(name, uri, "image") do + Parser.parse(rss, true, false) + end end def test_default_parser |