summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-02 23:16:36 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-02 23:16:36 +0000
commit2024133681cd0098404f21ea62529b1985de31fe (patch)
tree9bba2ba8ba77fc56eb232c37318566987448db2a
parent340a644889fd61f79c8e2d56ee5f18bc6bd44785 (diff)
* test/rss/test_taxonomy.rb, test/rss/test_parser_1.0.rb,
test/rss/test_image.rb, test/rss/rss-testcase.rb: ensured declaring XML namespaces. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_6@14091 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--test/rss/rss-testcase.rb9
-rw-r--r--test/rss/test_image.rb27
-rw-r--r--test/rss/test_parser_1.0.rb9
-rw-r--r--test/rss/test_taxonomy.rb16
-rw-r--r--version.h2
6 files changed, 58 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index ca9b33d3b3..c566db386f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Mon Dec 3 08:13:52 2007 Kouhei Sutou <kou@cozmixng.org>
+
+ * test/rss/test_taxonomy.rb, test/rss/test_parser_1.0.rb,
+ test/rss/test_image.rb, test/rss/rss-testcase.rb: ensured
+ declaring XML namespaces.
+
Sun Sep 23 21:57:25 2007 GOTOU Yuuzou <gotoyuzo@notwork.org>
* lib/net/http.rb: an SSL verification (the server hostname should
diff --git a/test/rss/rss-testcase.rb b/test/rss/rss-testcase.rb
index 21670bc05c..dc57b6b0e8 100644
--- a/test/rss/rss-testcase.rb
+++ b/test/rss/rss-testcase.rb
@@ -215,7 +215,14 @@ EOR
"<#{h elem_name} #{attrs_str}>\n#{contents_str}\n</#{h elem_name}>"
end
-
+
+ def xmlns_container(xmlns_decls, content)
+ attributes = xmlns_decls.collect do |prefix, uri|
+ "xmlns:#{h prefix}=\"#{h uri}\""
+ end.join(" ")
+ "<dummy #{attributes}>#{content}</dummy>"
+ end
+
private
def setup_dummy_channel(maker)
about = "http://hoge.com"
diff --git a/test/rss/test_image.rb b/test/rss/test_image.rb
index 241fdafb7d..381bcf0465 100644
--- a/test/rss/test_image.rb
+++ b/test/rss/test_image.rb
@@ -163,19 +163,23 @@ EOR
def test_favicon_to_s
favicon = @rss.channel.image_favicon
- expected = REXML::Document.new(make_element("#{@prefix}:favicon",
- @favicon_attrs,
- @favicon_contents))
- actual = REXML::Document.new(favicon.to_s(false, ""))
+ expected_xml = image_xmlns_container(make_element("#{@prefix}:favicon",
+ @favicon_attrs,
+ @favicon_contents))
+ expected = REXML::Document.new(expected_xml)
+ actual_xml = image_xmlns_container(favicon.to_s(false, ""))
+ actual = REXML::Document.new(actual_xml)
assert_equal(expected.to_s, actual.to_s)
end
def test_item_to_s
@rss.items.each_with_index do |item, i|
attrs, contents = @items[i]
- expected_s = make_element("#{@prefix}:item", attrs, contents)
- expected = REXML::Document.new(expected_s)
- actual = REXML::Document.new(item.image_item.to_s(false, ""))
+ expected_xml = make_element("#{@prefix}:item", attrs, contents)
+ expected_xml = image_xmlns_container(expected_xml)
+ expected = REXML::Document.new(expected_xml)
+ actual_xml = image_xmlns_container(item.image_item.to_s(false, ""))
+ actual = REXML::Document.new(actual_xml)
assert_equal(expected[0].attributes, actual[0].attributes)
@@ -187,5 +191,14 @@ EOR
end
end
+ private
+ def image_xmlns_container(content)
+ xmlns_container({
+ @prefix => @uri,
+ "dc" => "http://purl.org/dc/elements/1.1/",
+ "rdf" => "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
+ },
+ content)
+ end
end
end
diff --git a/test/rss/test_parser_1.0.rb b/test/rss/test_parser_1.0.rb
index 472602b04a..216881b767 100644
--- a/test/rss/test_parser_1.0.rb
+++ b/test/rss/test_parser_1.0.rb
@@ -498,6 +498,15 @@ EOR
Parser.parse(rss, true, false)
end
end
+
+ def test_unknown_duplicated_element
+ xmlns = {"test" => "http://localhost/test"}
+ assert_parse(make_RDF(<<-EOR, xmlns), :nothing_raised)
+ #{make_channel("<test:string/>")}
+ #{make_item}
+ #{make_image}
+ EOR
+ end
end
end
diff --git a/test/rss/test_taxonomy.rb b/test/rss/test_taxonomy.rb
index 10ae55190a..5109f3d892 100644
--- a/test/rss/test_taxonomy.rb
+++ b/test/rss/test_taxonomy.rb
@@ -144,8 +144,10 @@ EOR
end
@topic_nodes.each_with_index do |node, i|
- expected = REXML::Document.new(node).root
- actual = REXML::Document.new(@rss.taxo_topics[i].to_s(true, "")).root
+ expected_xml = taxo_xmlns_container(node)
+ expected = REXML::Document.new(expected_xml).root.elements[1]
+ actual_xml = taxo_xmlns_container(@rss.taxo_topics[i].to_s(true, ""))
+ actual = REXML::Document.new(actual_xml).root.elements[1]
expected_elems = expected.reject {|x| x.is_a?(REXML::Text)}
actual_elems = actual.reject {|x| x.is_a?(REXML::Text)}
expected_elems.sort! {|x, y| x.name <=> y.name}
@@ -155,6 +157,16 @@ EOR
assert_equal(expected.attributes.sort, actual.attributes.sort)
end
end
+
+ private
+ def taxo_xmlns_container(content)
+ xmlns_container({
+ @prefix => @uri,
+ "dc" => "http://purl.org/dc/elements/1.1/",
+ "rdf" => "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
+ },
+ content)
+ end
end
end
diff --git a/version.h b/version.h
index 69827e9810..493d82a265 100644
--- a/version.h
+++ b/version.h
@@ -2,7 +2,7 @@
#define RUBY_RELEASE_DATE "2007-12-03"
#define RUBY_VERSION_CODE 186
#define RUBY_RELEASE_CODE 20071203
-#define RUBY_PATCHLEVEL 112
+#define RUBY_PATCHLEVEL 113
#define RUBY_VERSION_MAJOR 1
#define RUBY_VERSION_MINOR 8