Sha256: d8532b260419bd76dff435d1e0e88460ac59b7b27e4918d642078dfb58b779db
Contents?: true
Size: 1.41 KB
Versions: 10
Compression:
Stored size: 1.41 KB
Contents
require 'test_helper' # Information class unit test class. class TextNodeTest < Test::Unit::TestCase def setup @node = Node.new(nil) end def test01 nodes = [] nodes.push(TextNode.new(@node)) nodes.push(TextNode.new(@node, 'Node 2')) nodes.push(TextNode.new(@node)) nodes.push(TextNode.new(@node, '')) assert(nodes[0].text == nil) assert(nodes[1].text == 'Node 2') assert(nodes[2].text == nil) assert(nodes[3].text == '') nodes[0].text = 'This is the altered text for node 1.' assert(nodes[0].text == 'This is the altered text for node 1.') nodes[1].append('La la la') nodes[2].append('La la la') assert(nodes[1].text == 'Node 2La la la') assert(nodes[2].text == 'La la la') nodes[2].text = nil nodes[1].insert(' - ', 6) nodes[2].insert('TEXT', 2) assert(nodes[1].text == 'Node 2 - La la la') assert(nodes[2].text == 'TEXT') nodes[2].text = nil nodes[3].text = '{\}' assert(nodes[0].to_rtf == 'This is the altered text for node 1.') assert(nodes[1].to_rtf == 'Node 2 - La la la') assert(nodes[2].to_rtf == '') assert(nodes[3].to_rtf == '\{\\\}') end def test02 begin TextNode.new(nil) flunk('Successfully created a TextNode with a nil parent.') rescue => error end end end
Version data entries
10 entries across 10 versions & 4 rubygems