ruby-changes:49079
From: eregon <ko1@a...>
Date: Wed, 13 Dec 2017 08:41:40 +0900 (JST)
Subject: [ruby-changes:49079] eregon:r61194 (trunk): Revert r61192 and r61193
eregon 2017-12-13 08:41:34 +0900 (Wed, 13 Dec 2017) New Revision: 61194 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61194 Log: Revert r61192 and r61193 * More general fix coming. Modified files: trunk/test/lib/test/unit/assertions.rb trunk/test/ruby/test_numeric.rb trunk/test/ruby/test_regexp.rb Index: test/lib/test/unit/assertions.rb =================================================================== --- test/lib/test/unit/assertions.rb (revision 61193) +++ test/lib/test/unit/assertions.rb (revision 61194) @@ -133,10 +133,13 @@ module Test https://github.com/ruby/ruby/blob/trunk/test/lib/test/unit/assertions.rb#L133 raise TypeError, "Expected #{expected.inspect} to be a kind of String or Regexp, not #{expected.class}" end - ex = assert_raise(exception, msg || proc {"Exception(#{exception}) with message matches to #{expected.inspect}"}) do - yield + ex = m = nil + EnvUtil.with_default_internal(expected.encoding) do + ex = assert_raise(exception, msg || proc {"Exception(#{exception}) with message matches to #{expected.inspect}"}) do + yield + end + m = ex.message end - m = ex.message msg = message(msg, "") {"Expected Exception(#{exception}) was raised, but the message doesn't match"} if assert == :assert_equal Index: test/ruby/test_numeric.rb =================================================================== --- test/ruby/test_numeric.rb (revision 61193) +++ test/ruby/test_numeric.rb (revision 61194) @@ -22,12 +22,10 @@ class TestNumeric < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_numeric.rb#L22 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::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 + 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}"} bug10711 = '[ruby-core:67405] [Bug #10711]' exp = "1.2 can't be coerced into Integer" Index: test/ruby/test_regexp.rb =================================================================== --- test/ruby/test_regexp.rb (revision 61193) +++ test/ruby/test_regexp.rb (revision 61194) @@ -667,11 +667,7 @@ class TestRegexp < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_regexp.rb#L667 key = "\u{3042}" [Encoding::UTF_8, Encoding::Shift_JIS, Encoding::EUC_JP].each do |enc| idx = key.encode(enc) - test.call {|m| - EnvUtil.with_default_external(enc) do - assert_raise_with_message(IndexError, /#{idx}/, bug10877) {m[idx]} - end - } + test.call {|m| assert_raise_with_message(IndexError, /#{idx}/, bug10877) {m[idx]} } end test.call {|m| assert_equal(/a/, m.regexp) } test.call {|m| assert_equal("abc", m.string) } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/