diff options
author | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-03-21 10:03:17 +0000 |
---|---|---|
committer | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-03-21 10:03:17 +0000 |
commit | abe876ed4e69d08868373051bebee6ab7e303954 (patch) | |
tree | fd5dfb00cf7a485e98ae179947b61093f6820a21 /test/rss/common.rb | |
parent | cfbe158faea79c6c61f04e99d1309e26bf9f1e54 (diff) |
* test/rss/*: Test::Unit::TestCase -> RSS::TestCase and
Test::Unit::Assertions -> RSS::Assertions.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rss/common.rb')
-rw-r--r-- | test/rss/common.rb | 156 |
1 files changed, 0 insertions, 156 deletions
diff --git a/test/rss/common.rb b/test/rss/common.rb deleted file mode 100644 index 15af960bc1..0000000000 --- a/test/rss/common.rb +++ /dev/null @@ -1,156 +0,0 @@ -# -*- tab-width: 2 -*- vim: ts=2 - -require 'my-assertions' - -module TestRSSMixin - - include RSS - - 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" - 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", - ] - - 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 - - def make_channel(content=nil) - <<-EOC -<channel rdf:about="#{RDF_ABOUT}"> - <title>#{TITLE_VALUE}</title> - <link>#{LINK_VALUE}</link> - <description>#{DESCRIPTION_VALUE}</description> - - <image rdf:resource="#{RDF_RESOURCE}" /> - - <items> - <rdf:Seq> -#{RESOURCES.collect do |res| '<rdf:li resource="' + res + '" />' end.join("\n")} - </rdf:Seq> - </items> - - <textinput rdf:resource="#{RDF_RESOURCE}" /> - -#{block_given? ? yield : content} -</channel> -EOC - end - - def make_image(content=nil) - <<-EOI -<image rdf:about="#{RDF_ABOUT}"> - <title>#{TITLE_VALUE}</title> - <url>#{URL_VALUE}</url> - <link>#{LINK_VALUE}</link> -#{block_given? ? yield : content} -</image> -EOI - end - - def make_item(content=nil) - <<-EOI -<item rdf:about="#{RDF_ABOUT}"> - <title>#{TITLE_VALUE}</title> - <link>#{LINK_VALUE}</link> - <description>#{DESCRIPTION_VALUE}</description> -#{block_given? ? yield : content} -</item> -EOI - end - - 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> -#{block_given? ? yield : content} -</textinput> -EOT - end - - def make_sample_RDF - make_RDF(<<-EOR) -#{make_channel} -#{make_image} -#{make_item} -#{make_textinput} -EOR - end - - def make_Rss2(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 - - def make_channel2(content=nil) - <<-EOC -<channel> - <title>#{TITLE_VALUE}</title> - <link>#{LINK_VALUE}</link> - <description>#{DESCRIPTION_VALUE}</description> - - <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> - <link>#{RDF_RESOURCE}</link> - </textInput> - -#{block_given? ? yield : content} -</channel> -EOC - end - - def make_item2(content=nil) - <<-EOI -<item> - <title>#{TITLE_VALUE}</title> - <link>#{LINK_VALUE}</link> - <description>#{DESCRIPTION_VALUE}</description> -#{block_given? ? yield : content} -</item> -EOI - end -end |