ruby-changes:32538
From: nobu <ko1@a...>
Date: Wed, 15 Jan 2014 18:52:29 +0900 (JST)
Subject: [ruby-changes:32538] nobu:r44617 (trunk): test_numeric.rb: default_external
nobu 2014-01-15 18:52:23 +0900 (Wed, 15 Jan 2014) New Revision: 44617 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44617 Log: test_numeric.rb: default_external * test/ruby/test_numeric.rb (test_coerce): manage Encoding.default_external. Modified files: trunk/test/ruby/test_numeric.rb Index: test/ruby/test_numeric.rb =================================================================== --- test/ruby/test_numeric.rb (revision 44616) +++ test/ruby/test_numeric.rb (revision 44617) @@ -1,4 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/test/ruby/test_numeric.rb#L1 require 'test/unit' +require_relative 'envutil' class TestNumeric < Test::Unit::TestCase class DummyNumeric < Numeric @@ -20,10 +21,18 @@ class TestNumeric < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_numeric.rb#L21 assert_raise_with_message(TypeError, /can't be coerced into /) {1|:foo} assert_raise_with_message(TypeError, /can't be coerced into /) {1^:foo} - assert_raise_with_message(TypeError, /:\u{3042}/) {1+:"\u{3042}"} - assert_raise_with_message(TypeError, /:\u{3042}/) {1&:"\u{3042}"} - assert_raise_with_message(TypeError, /:\u{3042}/) {1|:"\u{3042}"} - assert_raise_with_message(TypeError, /:\u{3042}/) {1^:"\u{3042}"} + EnvUtil.with_default_external(Encoding::UTF_8) do + assert_raise_with_message(TypeError, /:\u{3042}/) {1+:"\u{3042}"} + assert_raise_with_message(TypeError, /:\u{3042}/) {1&:"\u{3042}"} + assert_raise_with_message(TypeError, /:\u{3042}/) {1|:"\u{3042}"} + assert_raise_with_message(TypeError, /:\u{3042}/) {1^:"\u{3042}"} + end + EnvUtil.with_default_external(Encoding::US_ASCII) do + assert_raise_with_message(TypeError, /:"\\u3042"/) {1+:"\u{3042}"} + assert_raise_with_message(TypeError, /:"\\u3042"/) {1&:"\u{3042}"} + assert_raise_with_message(TypeError, /:"\\u3042"/) {1|:"\u{3042}"} + assert_raise_with_message(TypeError, /:"\\u3042"/) {1^:"\u{3042}"} + end end def test_dummynumeric -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/