1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/test/rexml/test_notationdecl_parsetest.rb
kou 43f944dcf1 * test/rexml/test_notationdecl_parsetest.rb: Split test patterns.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42281 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-31 12:59:28 +00:00

45 lines
1.1 KiB
Ruby

require 'test/unit'
require 'rexml/document'
class TestNotationDecl < Test::Unit::TestCase
private
def xml(internal_subset)
<<-XML
<!DOCTYPE r SYSTEM "urn:x-henrikmartensson:test" [
#{internal_subset}
]>
<r/>
XML
end
def parse(internal_subset)
REXML::Document.new(xml(internal_subset)).doctype
end
class TestCommon < self
def test_name
doctype = parse("<!NOTATION name PUBLIC 'urn:public-id'>")
assert_equal("name", doctype.notation("name").name)
end
end
class TestExternID < self
class TestPublic < self
class TestSystemLiteral < self
def test_single_quote
doctype = parse(<<-INTERNAL_SUBSET)
<!NOTATION name PUBLIC "public-id-literal" 'system-literal'>
INTERNAL_SUBSET
assert_equal("system-literal", doctype.notation("name").system)
end
def test_double_quote
doctype = parse(<<-INTERNAL_SUBSET)
<!NOTATION name PUBLIC "public-id-literal" "system-literal">
INTERNAL_SUBSET
assert_equal("system-literal", doctype.notation("name").system)
end
end
end
end
end