mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/rexml/sax2listener.rb (REXML::SAX2Listener#notationdecl): Fix
wrong number of arguments in the template listener. [Bug #8731] [ruby-dev:47582] Reported by Ippei Obayashi. * test/rexml/parser/test_sax2.rb: Add tests for parsing notation declarations with SAX2 API. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1864d57843
commit
45222164dc
3 changed files with 61 additions and 1 deletions
|
@ -1,3 +1,12 @@
|
|||
Sun Aug 11 19:06:03 2013 Kouhei Sutou <kou@cozmixng.org>
|
||||
|
||||
* lib/rexml/sax2listener.rb (REXML::SAX2Listener#notationdecl): Fix
|
||||
wrong number of arguments in the template listener.
|
||||
[Bug #8731] [ruby-dev:47582]
|
||||
Reported by Ippei Obayashi.
|
||||
* test/rexml/parser/test_sax2.rb: Add tests for parsing notation
|
||||
declarations with SAX2 API.
|
||||
|
||||
Sun Aug 11 18:44:04 2013 Kouhei Sutou <kou@cozmixng.org>
|
||||
|
||||
* lib/rexml/sax2listener.rb (REXML::SAX2Listener#elementdecl): Fix wrong
|
||||
|
|
|
@ -73,7 +73,7 @@ module REXML
|
|||
def entitydecl declaration
|
||||
end
|
||||
# <!NOTATION ...>
|
||||
def notationdecl content
|
||||
def notationdecl name, public_or_system, public_id, system_id
|
||||
end
|
||||
# Called when <![CDATA[ ... ]]> is encountered in a document.
|
||||
# @p content "..."
|
||||
|
|
|
@ -145,5 +145,56 @@ class TestSAX2Parser < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
class TestNotationDeclaration < self
|
||||
class Listener
|
||||
include REXML::SAX2Listener
|
||||
attr_reader :notation_declarations
|
||||
def initialize
|
||||
@notation_declarations = []
|
||||
end
|
||||
|
||||
def notationdecl(*declaration)
|
||||
super
|
||||
@notation_declarations << declaration
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def parse(internal_subset)
|
||||
listener = Listener.new
|
||||
parser = REXML::Parsers::SAX2Parser.new(xml(internal_subset))
|
||||
parser.listen(listener)
|
||||
parser.parse
|
||||
listener.notation_declarations
|
||||
end
|
||||
|
||||
class TestExternlID < self
|
||||
def test_system
|
||||
declaration = ["name", "SYSTEM", nil, "system-literal"]
|
||||
assert_equal([declaration],
|
||||
parse(<<-INTERNAL_SUBSET))
|
||||
<!NOTATION name SYSTEM "system-literal">
|
||||
INTERNAL_SUBSET
|
||||
end
|
||||
|
||||
def test_public
|
||||
declaration = ["name", "PUBLIC", "public-literal", "system-literal"]
|
||||
assert_equal([declaration], parse(<<-INTERNAL_SUBSET))
|
||||
<!NOTATION name PUBLIC "public-literal" "system-literal">
|
||||
INTERNAL_SUBSET
|
||||
end
|
||||
end
|
||||
|
||||
class TestPublicID < self
|
||||
def test_literal
|
||||
declaration = ["name", "PUBLIC", "public-literal", nil]
|
||||
assert_equal([declaration],
|
||||
parse(<<-INTERNAL_SUBSET))
|
||||
<!NOTATION name PUBLIC "public-literal">
|
||||
INTERNAL_SUBSET
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue