Created
April 9, 2010 15:45
-
-
Save yokolet/361294 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6) Error: | |
test_subclass_initialize_Nokogiri_XML_Attr(Nokogiri::XML::Node::TestSubclass): | |
ArgumentError: wrong # of arguments(3 for 2) | |
./test/xml/node/test_subclass.rb:49:in `test_subclass_initialize_Nokogiri_XML_Attr' | |
7) Error: | |
test_subclass_initialize_Nokogiri_XML_Comment(Nokogiri::XML::Node::TestSubclass): | |
ArgumentError: wrong # of arguments(3 for 2) | |
./test/xml/node/test_subclass.rb:49:in `test_subclass_initialize_Nokogiri_XML_Comment' | |
8) Error: | |
test_subclass_initialize_Nokogiri_XML_EntityReference(Nokogiri::XML::Node::TestSubclass): | |
ArgumentError: wrong # of arguments(3 for 2) | |
./test/xml/node/test_subclass.rb:49:in `test_subclass_initialize_Nokogiri_XML_EntityRef | |
erence' | |
9) Error: | |
test_subclass_initialize_Nokogiri_XML_Node(Nokogiri::XML::Node::TestSubclass): | |
ArgumentError: wrong # of arguments(3 for 2) | |
./test/xml/node/test_subclass.rb:49:in `test_subclass_initialize_Nokogiri_XML_Node' | |
10) Error: | |
test_subclass_initialize_Nokogiri_XML_Text(Nokogiri::XML::Node::TestSubclass): | |
ArgumentError: wrong # of arguments(3 for 2) | |
./test/xml/node/test_subclass.rb:49:in `test_subclass_initialize_Nokogiri_XML_Text' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "helper" | |
module Nokogiri | |
module XML | |
class Node | |
class TestSubclass < Nokogiri::TestCase | |
{ | |
Nokogiri::XML::CDATA => 'doc, "foo"', | |
Nokogiri::XML::Attr => 'doc, "foo"', | |
Nokogiri::XML::Comment => 'doc, "foo"', | |
Nokogiri::XML::EntityReference => 'doc, "foo"', | |
Nokogiri::XML::ProcessingInstruction => 'doc, "foo", "bar"', | |
Nokogiri::XML::DocumentFragment => 'doc', | |
Nokogiri::XML::Node => '"foo", doc', | |
Nokogiri::XML::Text => '"foo", doc', | |
}.each do |klass, constructor| | |
class_eval %{ | |
def test_subclass_#{klass.name.gsub('::', '_')} | |
doc = Nokogiri::XML::Document.new | |
klass = Class.new(#{klass.name}) | |
node = klass.new(#{constructor}) | |
assert_instance_of klass, node | |
end | |
} | |
class_eval <<-eocode, __FILE__, __LINE__ + 1 | |
def test_subclass_initialize_#{klass.name.gsub('::', '_')} | |
doc = Nokogiri::XML::Document.new | |
klass = Class.new(#{klass.name}) do | |
attr_accessor :initialized_with | |
def initialize *args | |
@initialized_with = args | |
end | |
end | |
node = klass.new(#{constructor}, 1) | |
assert_equal [#{constructor}, 1], node.initialized_with | |
end | |
eocode | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment