diff options
author | 2012-01-25 02:19:47 +0000 | |
---|---|---|
committer | 2012-01-25 02:19:47 +0000 | |
commit | 21313f635e5b38b7c4b8fb3a589a2846f1319221 (patch) | |
tree | df98f953a8a4a5e73b9bc18ab142ec090653d7be /dev-ruby/builder/files | |
parent | Migrate to EAPI=4, fix build with newer automake with patch from upstream, ad... (diff) | |
download | gentoo-2-21313f635e5b38b7c4b8fb3a589a2846f1319221.tar.gz gentoo-2-21313f635e5b38b7c4b8fb3a589a2846f1319221.tar.bz2 gentoo-2-21313f635e5b38b7c4b8fb3a589a2846f1319221.zip |
Fix conflict with fast_xs/hpricot and fix failing tests with Ruby 1.9.3.
(Portage version: 2.2.0_alpha84/cvs/Linux x86_64)
Diffstat (limited to 'dev-ruby/builder/files')
-rw-r--r-- | dev-ruby/builder/files/builder-3.0.0-tests.patch | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/dev-ruby/builder/files/builder-3.0.0-tests.patch b/dev-ruby/builder/files/builder-3.0.0-tests.patch new file mode 100644 index 000000000000..04eb16228db9 --- /dev/null +++ b/dev-ruby/builder/files/builder-3.0.0-tests.patch @@ -0,0 +1,55 @@ +diff --git a/lib/builder/xmlbase.rb b/lib/builder/xmlbase.rb +index 1a1e5f9..06f8807 100644 +--- a/lib/builder/xmlbase.rb ++++ b/lib/builder/xmlbase.rb +@@ -122,7 +122,9 @@ module Builder + def _escape(text) + result = XChar.encode(text) + begin +- result.encode(@encoding) ++ encoding = ::Encoding::find(@encoding) ++ raise Exception if encoding.dummy? ++ result.encode(encoding) + rescue + # if the encoding can't be supported, use numeric character references + result. +@@ -132,7 +134,12 @@ module Builder + end + else + def _escape(text) +- text.to_xs((@encoding != 'utf-8' or $KCODE != 'UTF8')) ++ # original_xs is defined by activesupport when fast_xs is ++ # loaded; since fast_xs (as of version 0.8.0) does not accept ++ # the encode parameter, use the original function if present. ++ toxs_method = ::String.method_defined?(:original_xs) ? :original_xs : :to_xs ++ ++ text.send(toxs_method, (@encoding != 'utf-8' or $KCODE != 'UTF8')) + end + end + +diff --git a/test/test_markupbuilder.rb b/test/test_markupbuilder.rb +index 63864ad..2d9b853 100644 +--- a/test/test_markupbuilder.rb ++++ b/test/test_markupbuilder.rb +@@ -446,13 +446,20 @@ class TestIndentedXmlMarkup < Test::Unit::TestCase + end + end + +- def test_use_entities_if_kcode_is_utf_but_encoding_is_something_else ++ def test_use_entities_if_kcode_is_utf_but_encoding_is_dummy_encoding + xml = Builder::XmlMarkup.new + xml.instruct!(:xml, :encoding => 'UTF-16') + xml.p(encode("\xE2\x80\x99", 'UTF8')) + assert_match(%r(<p>’</p>), xml.target!) # + end + ++ def test_use_entities_if_kcode_is_utf_but_encoding_is_unsupported_encoding ++ xml = Builder::XmlMarkup.new ++ xml.instruct!(:xml, :encoding => 'UCS-2') ++ xml.p(encode("\xE2\x80\x99", 'UTF8')) ++ assert_match(%r(<p>’</p>), xml.target!) # ++ end ++ + def test_use_utf8_if_encoding_defaults_and_kcode_is_utf8 + xml = Builder::XmlMarkup.new + xml.p(encode("\xE2\x80\x99",'UTF8')) |