1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
$:.unshift(File.dirname(__FILE__) + '/../lib')
require 'htmlentities/string'
require 'test/unit'
$KCODE = 'u'
class TestHTMLEntities < Test::Unit::TestCase
def test_string_responds_correctly_to_decode_entities
assert_equal('±', '±'.decode_entities)
end
def test_string_responds_correctly_to_encode_entities_with_no_parameters
assert_equal('"', '"'.encode_entities)
end
def test_string_responds_correctly_to_encode_entities_with_multiple_parameters
assert_equal(
'"bientôt" & 文字',
'"bientôt" & 文字'.encode_entities(:basic, :named, :hexadecimal)
)
end
end
|