From a750424cab13cab79de7d7922f32f31be6f415f3 Mon Sep 17 00:00:00 2001 From: kou Date: Sun, 28 Oct 2012 12:39:37 +0000 Subject: [PATCH] * 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 --- ChangeLog | 5 +++++ test/rexml/test_document.rb | 30 ++++++++++++++++-------------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 329f6d6a88..e48e9b7be3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sun Oct 28 21:37:34 2012 Kouhei Sutou + + * 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 * lib/rexml/source.rb (REXML::IOSource#initialize): Reduce diff --git a/test/rexml/test_document.rb b/test/rexml/test_document.rb index 02e4a69754..028fa988a6 100644 --- a/test/rexml/test_document.rb +++ b/test/rexml/test_document.rb @@ -225,24 +225,26 @@ EOX end class BomTest < self - def test_utf_16le - xml = <<-EOX.encode("UTF-16LE").force_encoding("ASCII-8BIT") + class HaveEncodingTest < self + def test_utf_16le + xml = <<-EOX.encode("UTF-16LE").force_encoding("ASCII-8BIT") Hello world! EOX - bom = "\ufeff".encode("UTF-16LE").force_encoding("ASCII-8BIT") - document = REXML::Document.new(bom + xml) - assert_equal("UTF-16", document.encoding) - end + bom = "\ufeff".encode("UTF-16LE").force_encoding("ASCII-8BIT") + document = REXML::Document.new(bom + xml) + assert_equal("UTF-16", document.encoding) + end - def test_utf_16be - xml = <<-EOX.encode("UTF-16BE").force_encoding("ASCII-8BIT") - -Hello world! -EOX - bom = "\ufeff".encode("UTF-16BE").force_encoding("ASCII-8BIT") - document = REXML::Document.new(bom + xml) - assert_equal("UTF-16", document.encoding) + def test_utf_16be + xml = <<-EOX.encode("UTF-16BE").force_encoding("ASCII-8BIT") + + Hello world! + EOX + bom = "\ufeff".encode("UTF-16BE").force_encoding("ASCII-8BIT") + document = REXML::Document.new(bom + xml) + assert_equal("UTF-16", document.encoding) + end end end end