summaryrefslogtreecommitdiff
path: root/test/rss/test_content.rb
diff options
context:
space:
mode:
authorkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-10-16 04:51:15 +0000
committerkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-10-16 04:51:15 +0000
commit891ad83098840851fb16f7ec4a664fc664792df0 (patch)
treee1d33d49cca9875ec515d3ee4ed0dc2686432941 /test/rss/test_content.rb
parent0ebac90b0ebb07ad2aa99080c8509559a7ddc74d (diff)
* lib/rss/: untabified.
* test/rss/: untabified. * lib/rss/0.9.rb (RSS::Rss#to_s): inent -> indent. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7048 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rss/test_content.rb')
-rw-r--r--test/rss/test_content.rb142
1 files changed, 71 insertions, 71 deletions
diff --git a/test/rss/test_content.rb b/test/rss/test_content.rb
index 24877d3ec9..c0f6e4292f 100644
--- a/test/rss/test_content.rb
+++ b/test/rss/test_content.rb
@@ -9,89 +9,89 @@ require "rss/1.0"
require "rss/content"
module RSS
- class TestContent < TestCase
-
- def setup
- @prefix = "content"
- @uri = "http://purl.org/rss/1.0/modules/content/"
-
- @parents = %w(item)
-
- @elems = {
- :encoded => "<em>ATTENTION</em>",
- }
-
- @content_nodes = @elems.collect do |name, value|
- "<#{@prefix}:#{name}>#{CGI.escapeHTML(value.to_s)}</#{@prefix}:#{name}>"
- end.join("\n")
-
- @rss_source = make_RDF(<<-EOR, {@prefix => @uri})
+ class TestContent < TestCase
+
+ def setup
+ @prefix = "content"
+ @uri = "http://purl.org/rss/1.0/modules/content/"
+
+ @parents = %w(item)
+
+ @elems = {
+ :encoded => "<em>ATTENTION</em>",
+ }
+
+ @content_nodes = @elems.collect do |name, value|
+ "<#{@prefix}:#{name}>#{CGI.escapeHTML(value.to_s)}</#{@prefix}:#{name}>"
+ end.join("\n")
+
+ @rss_source = make_RDF(<<-EOR, {@prefix => @uri})
#{make_channel()}
#{make_image()}
#{make_item(@content_nodes)}
#{make_textinput()}
EOR
- @rss = Parser.parse(@rss_source)
- end
-
- def test_parser
+ @rss = Parser.parse(@rss_source)
+ end
+
+ def test_parser
- assert_nothing_raised do
- Parser.parse(@rss_source)
- end
-
- @elems.each do |tag, value|
- assert_too_much_tag(tag.to_s, "item") do
- Parser.parse(make_RDF(<<-EOR, {@prefix => @uri}))
+ assert_nothing_raised do
+ Parser.parse(@rss_source)
+ end
+
+ @elems.each do |tag, value|
+ assert_too_much_tag(tag.to_s, "item") do
+ Parser.parse(make_RDF(<<-EOR, {@prefix => @uri}))
#{make_channel()}
#{make_item(("<" + @prefix + ":" + tag.to_s + ">" +
- CGI.escapeHTML(value.to_s) +
- "</" + @prefix + ":" + tag.to_s + ">") * 2)}
+ CGI.escapeHTML(value.to_s) +
+ "</" + @prefix + ":" + tag.to_s + ">") * 2)}
EOR
- end
- end
+ end
+ end
- end
-
- def test_accessor
-
- new_value = {
- :encoded => "<![CDATA[<it>hoge</it>]]>",
- }
+ end
+
+ def test_accessor
+
+ new_value = {
+ :encoded => "<![CDATA[<it>hoge</it>]]>",
+ }
- @elems.each do |name, value|
- @parents.each do |parent|
- meth = "#{RSS::CONTENT_PREFIX}_#{name}"
- assert_equal(value, @rss.send(parent).send(meth))
- @rss.send(parent).send("#{meth}=", new_value[name].to_s)
- assert_equal(new_value[name], @rss.send(parent).send(meth))
- end
- end
+ @elems.each do |name, value|
+ @parents.each do |parent|
+ meth = "#{RSS::CONTENT_PREFIX}_#{name}"
+ assert_equal(value, @rss.send(parent).send(meth))
+ @rss.send(parent).send("#{meth}=", new_value[name].to_s)
+ assert_equal(new_value[name], @rss.send(parent).send(meth))
+ end
+ end
- end
-
- def test_to_s
-
- @elems.each do |name, value|
- excepted = "<#{@prefix}:#{name}>#{CGI.escapeHTML(value)}</#{@prefix}:#{name}>"
- @parents.each do |parent|
- meth = "#{RSS::CONTENT_PREFIX}_#{name}_element"
- assert_equal(excepted, @rss.send(parent).send(meth))
- end
- end
+ end
+
+ def test_to_s
+
+ @elems.each do |name, value|
+ excepted = "<#{@prefix}:#{name}>#{CGI.escapeHTML(value)}</#{@prefix}:#{name}>"
+ @parents.each do |parent|
+ meth = "#{RSS::CONTENT_PREFIX}_#{name}_element"
+ assert_equal(excepted, @rss.send(parent).send(meth))
+ end
+ end
- REXML::Document.new(@rss_source).root.each_element do |parent|
- if @parents.include?(parent.name)
- parent.each_element do |elem|
- if elem.namespace == @uri
- assert_equal(elem.text, @elems[elem.name.intern].to_s)
- end
- end
- end
- end
-
- end
-
- end
+ REXML::Document.new(@rss_source).root.each_element do |parent|
+ if @parents.include?(parent.name)
+ parent.each_element do |elem|
+ if elem.namespace == @uri
+ assert_equal(elem.text, @elems[elem.name.intern].to_s)
+ end
+ end
+ end
+ end
+
+ end
+
+ end
end