Sha256: f4f202e89c75e315dd8752a7d2c18fe74ec71f4a1caf834dc2242033da640165
Contents?: true
Size: 2 KB
Versions: 2
Compression:
Stored size: 2 KB
Contents
# encoding: UTF-8 require File.expand_path("../common", __FILE__) if ENCODING_AWARE_RUBY class HTMLEntities::Ruby19Test < Test::Unit::TestCase def test_should_encode_ascii_to_ascii s = "<elan>".encode(Encoding::US_ASCII) assert_equal Encoding::US_ASCII, s.encoding t = HTMLEntities.new.encode(s) assert_equal "<elan>", t assert_equal Encoding::US_ASCII, t.encoding end def test_should_encode_utf8_to_utf8_if_needed s = "<élan>" assert_equal Encoding::UTF_8, s.encoding t = HTMLEntities.new.encode(s) assert_equal "<élan>", t assert_equal Encoding::UTF_8, t.encoding end def test_should_encode_utf8_to_ascii_if_possible s = "<elan>" assert_equal Encoding::UTF_8, s.encoding t = HTMLEntities.new.encode(s) assert_equal "<elan>", t assert_equal Encoding::US_ASCII, t.encoding end def test_should_encode_other_encoding_to_utf8 s = "<élan>".encode(Encoding::ISO_8859_1) assert_equal Encoding::ISO_8859_1, s.encoding t = HTMLEntities.new.encode(s) assert_equal "<élan>", t assert_equal Encoding::UTF_8, t.encoding end def test_should_decode_ascii_to_utf8 s = "<élan>".encode(Encoding::US_ASCII) assert_equal Encoding::US_ASCII, s.encoding t = HTMLEntities.new.decode(s) assert_equal "<élan>", t assert_equal Encoding::UTF_8, t.encoding end def test_should_decode_utf8_to_utf8 s = "<élan>".encode(Encoding::UTF_8) assert_equal Encoding::UTF_8, s.encoding t = HTMLEntities.new.decode(s) assert_equal "<élan>", t assert_equal Encoding::UTF_8, t.encoding end def test_should_decode_other_encoding_to_utf8 s = "<élan>".encode(Encoding::ISO_8859_1) assert_equal Encoding::ISO_8859_1, s.encoding t = HTMLEntities.new.decode(s) assert_equal "<élan>", t assert_equal Encoding::UTF_8, t.encoding end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
htmlentities-4.3.1 | test/ruby_1_9_test.rb |
htmlentities-4.3.0 | test/ruby_1_9_test.rb |