You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
696 B
Ruby
36 lines
696 B
Ruby
require 'test/unit'
|
|
require 'htree/text'
|
|
|
|
class TestText < Test::Unit::TestCase
|
|
def test_new
|
|
assert_equal("abc&amp;def", HTree::Text.new("abc&def").rcdata)
|
|
end
|
|
|
|
=begin
|
|
def test_parse
|
|
assert_equal("abc&def", HTree::Text.parse("abc&def").rcdata)
|
|
end
|
|
|
|
def test_to_s
|
|
assert_equal("abc&def", HTree::Text.parse("abc&def").to_s)
|
|
end
|
|
=end
|
|
|
|
def kcode(kc)
|
|
old = $KCODE
|
|
begin
|
|
$KCODE = kc
|
|
yield
|
|
ensure
|
|
$KCODE = old
|
|
end
|
|
end
|
|
|
|
def test_normalize
|
|
kcode('EUC') {
|
|
assert_equal("<ABC&& \xa6\xc1",
|
|
HTree::Text.new_internal("<ABC&& α").normalized_rcdata)
|
|
}
|
|
end
|
|
end
|