forked from maik/xml-simple
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtc_nick.rb
executable file
·36 lines (29 loc) · 1008 Bytes
/
tc_nick.rb
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
31
32
33
34
35
36
$: << File.join(File.dirname(__FILE__), '../lib')
require 'test/unit'
require 'xmlsimple'
class NodeToTextTests < Test::Unit::TestCase
def setup
@xmlin = XmlSimple.new
@element = REXML::Element.new("abc")
@text = REXML::Text.new("<abc/>")
@attribute = REXML::Attribute.new("name", "<abc/>")
@element.add_attribute(@attribute)
@element.add_text(@text)
end
def test_node_to_text_on_element
assert_equal "<abc/>", @xmlin.send(:node_to_text, @element)
end
def test_node_to_text_on_text
assert_equal "<abc/>", @xmlin.send(:node_to_text, @text)
end
def test_node_to_text_on_attribute
assert_equal "<abc/>", @xmlin.send(:node_to_text, @attribute)
end
def test_node_to_text_on_doubly_normalized_attribute
@attribute = REXML::Attribute.new("name", "&lt;abc/&gt;")
assert_equal "<abc/>", @xmlin.send(:node_to_text, @attribute)
end
def test_node_to_text_on_nil
assert_nil @xmlin.send(:node_to_text, nil)
end
end