diff options
author | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-10-16 04:51:15 +0000 |
---|---|---|
committer | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-10-16 04:51:15 +0000 |
commit | 891ad83098840851fb16f7ec4a664fc664792df0 (patch) | |
tree | e1d33d49cca9875ec515d3ee4ed0dc2686432941 /test/rss/rss-testcase.rb | |
parent | 0ebac90b0ebb07ad2aa99080c8509559a7ddc74d (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/rss-testcase.rb')
-rw-r--r-- | test/rss/rss-testcase.rb | 232 |
1 files changed, 116 insertions, 116 deletions
diff --git a/test/rss/rss-testcase.rb b/test/rss/rss-testcase.rb index e7195f41be..098263a392 100644 --- a/test/rss/rss-testcase.rb +++ b/test/rss/rss-testcase.rb @@ -4,182 +4,182 @@ require "test/unit" require 'rss-assertions' module RSS - class TestCase < Test::Unit::TestCase - - include RSS - include Assertions - - XMLDECL_VERSION = "1.0" - XMLDECL_ENCODING = "UTF-8" - XMLDECL_STANDALONE = "no" - - RDF_ABOUT = "http://www.xml.com/xml/news.rss" - RDF_RESOURCE = "http://xml.com/universal/images/xml_tiny.gif" - TITLE_VALUE = "XML.com" - LINK_VALUE = "http://xml.com/pub" - URL_VALUE = "http://xml.com/universal/images/xml_tiny.gif" - NAME_VALUE = "hogehoge" - LANGUAGE_VALUE = "ja" - DESCRIPTION_VALUE = " + class TestCase < Test::Unit::TestCase + + include RSS + include Assertions + + XMLDECL_VERSION = "1.0" + XMLDECL_ENCODING = "UTF-8" + XMLDECL_STANDALONE = "no" + + RDF_ABOUT = "http://www.xml.com/xml/news.rss" + RDF_RESOURCE = "http://xml.com/universal/images/xml_tiny.gif" + TITLE_VALUE = "XML.com" + LINK_VALUE = "http://xml.com/pub" + URL_VALUE = "http://xml.com/universal/images/xml_tiny.gif" + NAME_VALUE = "hogehoge" + LANGUAGE_VALUE = "ja" + DESCRIPTION_VALUE = " XML.com features a rich mix of information and services for the XML community. - " - RESOURCES = [ - "http://xml.com/pub/2000/08/09/xslt/xslt.html", - "http://xml.com/pub/2000/08/09/rdfdb/index.html", - ] - - CLOUD_DOMAIN = "data.ourfavoritesongs.com" - CLOUD_PORT = "80" - CLOUD_PATH = "/RPC2" - CLOUD_REGISTER_PROCEDURE = "ourFavoriteSongs.rssPleaseNotify" - CLOUD_PROTOCOL = "xml-rpc" - - ENCLOSURE_URL = "http://www.scripting.com/mp3s/weatherReportSuite.mp3" - ENCLOSURE_LENGTH = "12216320" - ENCLOSURE_TYPE = "audio/mpeg" - - CATEGORY_DOMAIN = "http://www.superopendirectory.com/" - - def default_test - # This class isn't tested - end - - private - def make_xmldecl(v=XMLDECL_VERSION, e=XMLDECL_ENCODING, s=XMLDECL_STANDALONE) - rv = "<?xml version='#{v}'" - rv << " encoding='#{e}'" if e - rv << " standalone='#{s}'" if s - rv << "?>" - rv - end - - def make_RDF(content=nil, xmlns=[]) - <<-EORSS + " + RESOURCES = [ + "http://xml.com/pub/2000/08/09/xslt/xslt.html", + "http://xml.com/pub/2000/08/09/rdfdb/index.html", + ] + + CLOUD_DOMAIN = "data.ourfavoritesongs.com" + CLOUD_PORT = "80" + CLOUD_PATH = "/RPC2" + CLOUD_REGISTER_PROCEDURE = "ourFavoriteSongs.rssPleaseNotify" + CLOUD_PROTOCOL = "xml-rpc" + + ENCLOSURE_URL = "http://www.scripting.com/mp3s/weatherReportSuite.mp3" + ENCLOSURE_LENGTH = "12216320" + ENCLOSURE_TYPE = "audio/mpeg" + + CATEGORY_DOMAIN = "http://www.superopendirectory.com/" + + def default_test + # This class isn't tested + end + + private + def make_xmldecl(v=XMLDECL_VERSION, e=XMLDECL_ENCODING, s=XMLDECL_STANDALONE) + rv = "<?xml version='#{v}'" + rv << " encoding='#{e}'" if e + rv << " standalone='#{s}'" if s + rv << "?>" + rv + end + + def make_RDF(content=nil, xmlns=[]) + <<-EORSS #{make_xmldecl} <rdf:RDF xmlns="#{URI}" xmlns:rdf="#{RDF::URI}" #{xmlns.collect {|pre, uri| "xmlns:#{pre}='#{uri}'"}.join(' ')}> #{block_given? ? yield : content} </rdf:RDF> EORSS - end + end - def make_channel(content=nil) - <<-EOC + def make_channel(content=nil) + <<-EOC <channel rdf:about="#{RDF_ABOUT}"> - <title>#{TITLE_VALUE}</title> - <link>#{LINK_VALUE}</link> - <description>#{DESCRIPTION_VALUE}</description> + <title>#{TITLE_VALUE}</title> + <link>#{LINK_VALUE}</link> + <description>#{DESCRIPTION_VALUE}</description> - <image rdf:resource="#{RDF_RESOURCE}" /> + <image rdf:resource="#{RDF_RESOURCE}" /> - <items> - <rdf:Seq> + <items> + <rdf:Seq> #{RESOURCES.collect do |res| '<rdf:li resource="' + res + '" />' end.join("\n")} - </rdf:Seq> - </items> + </rdf:Seq> + </items> - <textinput rdf:resource="#{RDF_RESOURCE}" /> + <textinput rdf:resource="#{RDF_RESOURCE}" /> #{block_given? ? yield : content} </channel> EOC - end + end - def make_image(content=nil) - <<-EOI + def make_image(content=nil) + <<-EOI <image rdf:about="#{RDF_ABOUT}"> - <title>#{TITLE_VALUE}</title> - <url>#{URL_VALUE}</url> - <link>#{LINK_VALUE}</link> + <title>#{TITLE_VALUE}</title> + <url>#{URL_VALUE}</url> + <link>#{LINK_VALUE}</link> #{block_given? ? yield : content} </image> EOI - end + end - def make_item(content=nil) - <<-EOI + def make_item(content=nil) + <<-EOI <item rdf:about="#{RDF_ABOUT}"> - <title>#{TITLE_VALUE}</title> - <link>#{LINK_VALUE}</link> - <description>#{DESCRIPTION_VALUE}</description> + <title>#{TITLE_VALUE}</title> + <link>#{LINK_VALUE}</link> + <description>#{DESCRIPTION_VALUE}</description> #{block_given? ? yield : content} </item> EOI - end + end - def make_textinput(content=nil) - <<-EOT + def make_textinput(content=nil) + <<-EOT <textinput rdf:about="#{RDF_ABOUT}"> - <title>#{TITLE_VALUE}</title> - <description>#{DESCRIPTION_VALUE}</description> - <name>#{NAME_VALUE}</name> - <link>#{LINK_VALUE}</link> + <title>#{TITLE_VALUE}</title> + <description>#{DESCRIPTION_VALUE}</description> + <name>#{NAME_VALUE}</name> + <link>#{LINK_VALUE}</link> #{block_given? ? yield : content} </textinput> EOT - end + end - def make_sample_RDF - make_RDF(<<-EOR) + def make_sample_RDF + make_RDF(<<-EOR) #{make_channel} #{make_image} #{make_item} #{make_textinput} EOR - end + end - def make_rss20(content=nil, xmlns=[]) - <<-EORSS + def make_rss20(content=nil, xmlns=[]) + <<-EORSS #{make_xmldecl} <rss version="2.0" #{xmlns.collect {|pre, uri| "xmlns:#{pre}='#{uri}'"}.join(' ')}> #{block_given? ? yield : content} </rss> EORSS - end + end - def make_channel20(content=nil) - <<-EOC + def make_channel20(content=nil) + <<-EOC <channel> - <title>#{TITLE_VALUE}</title> - <link>#{LINK_VALUE}</link> - <description>#{DESCRIPTION_VALUE}</description> - <language>#{LANGUAGE_VALUE}</language> + <title>#{TITLE_VALUE}</title> + <link>#{LINK_VALUE}</link> + <description>#{DESCRIPTION_VALUE}</description> + <language>#{LANGUAGE_VALUE}</language> - <image> - <url>#{RDF_RESOURCE}</url> - <title>#{TITLE_VALUE}</title> - <link>#{LINK_VALUE}</link> - </image> + <image> + <url>#{RDF_RESOURCE}</url> + <title>#{TITLE_VALUE}</title> + <link>#{LINK_VALUE}</link> + </image> #{RESOURCES.collect do |res| '<item><link>' + res + '</link></item>' end.join("\n")} - <textInput> - <title>#{TITLE_VALUE}</title> - <description>#{DESCRIPTION_VALUE}</description> - <name>#{NAME_VALUE}</name> - <link>#{RDF_RESOURCE}</link> - </textInput> + <textInput> + <title>#{TITLE_VALUE}</title> + <description>#{DESCRIPTION_VALUE}</description> + <name>#{NAME_VALUE}</name> + <link>#{RDF_RESOURCE}</link> + </textInput> #{block_given? ? yield : content} </channel> EOC - end + end - def make_item20(content=nil) - <<-EOI + def make_item20(content=nil) + <<-EOI <item> - <title>#{TITLE_VALUE}</title> - <link>#{LINK_VALUE}</link> - <description>#{DESCRIPTION_VALUE}</description> + <title>#{TITLE_VALUE}</title> + <link>#{LINK_VALUE}</link> + <description>#{DESCRIPTION_VALUE}</description> #{block_given? ? yield : content} </item> EOI - end + end - def make_cloud20 - <<-EOC + def make_cloud20 + <<-EOC <cloud domain="#{CLOUD_DOMAIN}" port="#{CLOUD_PORT}" @@ -187,7 +187,7 @@ EOI registerProcedure="#{CLOUD_REGISTER_PROCEDURE}" protocol="#{CLOUD_PROTOCOL}" /> EOC - end + end - end + end end |