mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
merge r23450.
* lib/rss/maker.rb, lib/rss/maker/0.9.rb, test/test_maker_*.rb: add RSS::Maker.supported? git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@23463 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
df8d8394ba
commit
6a5794bd7c
8 changed files with 50 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Sat May 16 19:46:30 2009 Kouhei Sutou <kou@cozmixng.org>
|
||||||
|
|
||||||
|
* lib/rss/maker.rb, lib/rss/maker/0.9.rb,
|
||||||
|
test/test_maker_*.rb: add RSS::Maker.supported?
|
||||||
|
|
||||||
Sat May 16 19:44:09 2009 Kouhei Sutou <kou@cozmixng.org>
|
Sat May 16 19:44:09 2009 Kouhei Sutou <kou@cozmixng.org>
|
||||||
|
|
||||||
* lib/rss/content/*, lib/rss/dublincore/*: fix circular require.
|
* lib/rss/content/*, lib/rss/dublincore/*: fix circular require.
|
||||||
|
|
|
@ -27,6 +27,10 @@ module RSS
|
||||||
MAKERS.values.collect {|info| info[:maker]}.uniq
|
MAKERS.values.collect {|info| info[:maker]}.uniq
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def supported?(version)
|
||||||
|
versions.include?(version)
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
# Can I remove this method?
|
# Can I remove this method?
|
||||||
def maker(version)
|
def maker(version)
|
||||||
|
|
|
@ -501,6 +501,7 @@ module RSS
|
||||||
add_maker("0.9", "0.92", RSS092)
|
add_maker("0.9", "0.92", RSS092)
|
||||||
add_maker("0.91", "0.91", RSS091)
|
add_maker("0.91", "0.91", RSS091)
|
||||||
add_maker("0.92", "0.92", RSS092)
|
add_maker("0.92", "0.92", RSS092)
|
||||||
|
add_maker("rss0.9", "0.92", RSS092)
|
||||||
add_maker("rss0.91", "0.91", RSS091)
|
add_maker("rss0.91", "0.91", RSS091)
|
||||||
add_maker("rss0.92", "0.92", RSS092)
|
add_maker("rss0.92", "0.92", RSS092)
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,17 @@ require "rss/maker"
|
||||||
|
|
||||||
module RSS
|
module RSS
|
||||||
class TestMaker09 < TestCase
|
class TestMaker09 < TestCase
|
||||||
|
def test_supported?
|
||||||
|
assert(RSS::Maker.supported?("0.9"))
|
||||||
|
assert(RSS::Maker.supported?("rss0.9"))
|
||||||
|
assert(RSS::Maker.supported?("0.91"))
|
||||||
|
assert(RSS::Maker.supported?("rss0.91"))
|
||||||
|
assert(RSS::Maker.supported?("0.92"))
|
||||||
|
assert(RSS::Maker.supported?("rss0.92"))
|
||||||
|
assert(!RSS::Maker.supported?("0.93"))
|
||||||
|
assert(!RSS::Maker.supported?("rss0.93"))
|
||||||
|
end
|
||||||
|
|
||||||
def test_find_class
|
def test_find_class
|
||||||
assert_equal(RSS::Maker::RSS091, RSS::Maker["0.91"])
|
assert_equal(RSS::Maker::RSS091, RSS::Maker["0.91"])
|
||||||
assert_equal(RSS::Maker::RSS091, RSS::Maker["rss0.91"])
|
assert_equal(RSS::Maker::RSS091, RSS::Maker["rss0.91"])
|
||||||
|
|
|
@ -4,6 +4,13 @@ require "rss/maker"
|
||||||
|
|
||||||
module RSS
|
module RSS
|
||||||
class TestMaker10 < TestCase
|
class TestMaker10 < TestCase
|
||||||
|
def test_supported?
|
||||||
|
assert(RSS::Maker.supported?("1.0"))
|
||||||
|
assert(RSS::Maker.supported?("rss1.0"))
|
||||||
|
assert(!RSS::Maker.supported?("1.1"))
|
||||||
|
assert(!RSS::Maker.supported?("rss1.1"))
|
||||||
|
end
|
||||||
|
|
||||||
def test_find_class
|
def test_find_class
|
||||||
assert_equal(RSS::Maker::RSS10, RSS::Maker["1.0"])
|
assert_equal(RSS::Maker::RSS10, RSS::Maker["1.0"])
|
||||||
assert_equal(RSS::Maker::RSS10, RSS::Maker["rss1.0"])
|
assert_equal(RSS::Maker::RSS10, RSS::Maker["rss1.0"])
|
||||||
|
|
|
@ -4,6 +4,13 @@ require "rss/maker"
|
||||||
|
|
||||||
module RSS
|
module RSS
|
||||||
class TestMaker20 < TestCase
|
class TestMaker20 < TestCase
|
||||||
|
def test_supported?
|
||||||
|
assert(RSS::Maker.supported?("2.0"))
|
||||||
|
assert(RSS::Maker.supported?("rss2.0"))
|
||||||
|
assert(!RSS::Maker.supported?("2.2"))
|
||||||
|
assert(!RSS::Maker.supported?("rss2.2"))
|
||||||
|
end
|
||||||
|
|
||||||
def test_find_class
|
def test_find_class
|
||||||
assert_equal(RSS::Maker::RSS20, RSS::Maker["2.0"])
|
assert_equal(RSS::Maker::RSS20, RSS::Maker["2.0"])
|
||||||
assert_equal(RSS::Maker::RSS20, RSS::Maker["rss2.0"])
|
assert_equal(RSS::Maker::RSS20, RSS::Maker["rss2.0"])
|
||||||
|
|
|
@ -4,6 +4,12 @@ require "rss/maker"
|
||||||
|
|
||||||
module RSS
|
module RSS
|
||||||
class TestMakerAtomEntry < TestCase
|
class TestMakerAtomEntry < TestCase
|
||||||
|
def test_supported?
|
||||||
|
assert(RSS::Maker.supported?("atom:entry"))
|
||||||
|
assert(RSS::Maker.supported?("atom1.0:entry"))
|
||||||
|
assert(!RSS::Maker.supported?("atom2.0:entry"))
|
||||||
|
end
|
||||||
|
|
||||||
def test_find_class
|
def test_find_class
|
||||||
assert_equal(RSS::Maker::Atom::Entry, RSS::Maker["atom:entry"])
|
assert_equal(RSS::Maker::Atom::Entry, RSS::Maker["atom:entry"])
|
||||||
assert_equal(RSS::Maker::Atom::Entry, RSS::Maker["atom1.0:entry"])
|
assert_equal(RSS::Maker::Atom::Entry, RSS::Maker["atom1.0:entry"])
|
||||||
|
|
|
@ -4,6 +4,15 @@ require "rss/maker"
|
||||||
|
|
||||||
module RSS
|
module RSS
|
||||||
class TestMakerAtomFeed < TestCase
|
class TestMakerAtomFeed < TestCase
|
||||||
|
def test_supported?
|
||||||
|
assert(RSS::Maker.supported?("atom"))
|
||||||
|
assert(RSS::Maker.supported?("atom:feed"))
|
||||||
|
assert(RSS::Maker.supported?("atom1.0"))
|
||||||
|
assert(RSS::Maker.supported?("atom1.0:feed"))
|
||||||
|
assert(!RSS::Maker.supported?("atom2.0"))
|
||||||
|
assert(!RSS::Maker.supported?("atom2.0:feed"))
|
||||||
|
end
|
||||||
|
|
||||||
def test_find_class
|
def test_find_class
|
||||||
assert_equal(RSS::Maker::Atom::Feed, RSS::Maker["atom"])
|
assert_equal(RSS::Maker::Atom::Feed, RSS::Maker["atom"])
|
||||||
assert_equal(RSS::Maker::Atom::Feed, RSS::Maker["atom:feed"])
|
assert_equal(RSS::Maker::Atom::Feed, RSS::Maker["atom:feed"])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue