1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
require "helper"
module Nokogiri
module XML
class TestProcessingInstruction < Nokogiri::TestCase
def setup
super
@xml = Nokogiri::XML.parse(File.read(XML_FILE), XML_FILE)
end
def test_type
assert_equal(Node::PI_NODE, @xml.children[0].type)
end
def test_name
assert_equal 'TEST-STYLE', @xml.children[0].name
end
def test_new
assert ref = ProcessingInstruction.new(@xml, 'name', 'content')
assert_instance_of ProcessingInstruction, ref
end
def test_many_new
100.times { ProcessingInstruction.new(@xml, 'foo', 'bar') }
@xml.root << ProcessingInstruction.new(@xml, 'foo', 'bar')
end
end
end
end
|