* test/rexml/test_document.rb: Group tests that they parse
UTF-16XX encoded XML that has encoding="UTF-16" in XML declaration. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37362 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
2a42c1bd3a
commit
a750424cab
@ -1,3 +1,8 @@
|
|||||||
|
Sun Oct 28 21:37:34 2012 Kouhei Sutou <kou@cozmixng.org>
|
||||||
|
|
||||||
|
* test/rexml/test_document.rb: Group tests that they parse
|
||||||
|
UTF-16XX encoded XML that has encoding="UTF-16" in XML declaration.
|
||||||
|
|
||||||
Sun Oct 28 21:25:11 2012 Kouhei Sutou <kou@cozmixng.org>
|
Sun Oct 28 21:25:11 2012 Kouhei Sutou <kou@cozmixng.org>
|
||||||
|
|
||||||
* lib/rexml/source.rb (REXML::IOSource#initialize): Reduce
|
* lib/rexml/source.rb (REXML::IOSource#initialize): Reduce
|
||||||
|
@ -225,24 +225,26 @@ EOX
|
|||||||
end
|
end
|
||||||
|
|
||||||
class BomTest < self
|
class BomTest < self
|
||||||
def test_utf_16le
|
class HaveEncodingTest < self
|
||||||
xml = <<-EOX.encode("UTF-16LE").force_encoding("ASCII-8BIT")
|
def test_utf_16le
|
||||||
|
xml = <<-EOX.encode("UTF-16LE").force_encoding("ASCII-8BIT")
|
||||||
<?xml version="1.0" encoding="UTF-16"?>
|
<?xml version="1.0" encoding="UTF-16"?>
|
||||||
<message>Hello world!</message>
|
<message>Hello world!</message>
|
||||||
EOX
|
EOX
|
||||||
bom = "\ufeff".encode("UTF-16LE").force_encoding("ASCII-8BIT")
|
bom = "\ufeff".encode("UTF-16LE").force_encoding("ASCII-8BIT")
|
||||||
document = REXML::Document.new(bom + xml)
|
document = REXML::Document.new(bom + xml)
|
||||||
assert_equal("UTF-16", document.encoding)
|
assert_equal("UTF-16", document.encoding)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_utf_16be
|
def test_utf_16be
|
||||||
xml = <<-EOX.encode("UTF-16BE").force_encoding("ASCII-8BIT")
|
xml = <<-EOX.encode("UTF-16BE").force_encoding("ASCII-8BIT")
|
||||||
<?xml version="1.0" encoding="UTF-16"?>
|
<?xml version="1.0" encoding="UTF-16"?>
|
||||||
<message>Hello world!</message>
|
<message>Hello world!</message>
|
||||||
EOX
|
EOX
|
||||||
bom = "\ufeff".encode("UTF-16BE").force_encoding("ASCII-8BIT")
|
bom = "\ufeff".encode("UTF-16BE").force_encoding("ASCII-8BIT")
|
||||||
document = REXML::Document.new(bom + xml)
|
document = REXML::Document.new(bom + xml)
|
||||||
assert_equal("UTF-16", document.encoding)
|
assert_equal("UTF-16", document.encoding)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user