File: test-raw_string.rb

package info (click to toggle)
ruby-htree 0.8%2Bdfsg-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 520 kB
  • sloc: ruby: 5,928; makefile: 23
file content (17 lines) | stat: -rw-r--r-- 467 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
require 'test/unit'
require 'htree'

class TestRawString < Test::Unit::TestCase
  def test_elem
    t = HTree.parse("<a>x</a>")
    assert_equal("<a>x</a>", t.root.raw_string)
    assert_equal("<a>x</a>", t.root.raw_string) # raw_string shouldn't have side effect.
  end

  def test_no_raw_string
    t = HTree::Elem.new('a')
    assert_equal(nil, t.raw_string)
    t = HTree::Elem.new('a', HTree.parse("<a>x</a>").root)
    assert_equal(nil, t.raw_string)
  end
end