ruby-changes:49078
From: eregon <ko1@a...>
Date: Wed, 13 Dec 2017 07:37:45 +0900 (JST)
Subject: [ruby-changes:49078] eregon:r61193 (trunk): Use EnvUtil.with_default_external in tests needing it
eregon 2017-12-13 07:37:40 +0900 (Wed, 13 Dec 2017) New Revision: 61193 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61193 Log: Use EnvUtil.with_default_external in tests needing it * Reverts part of r54522. Modified files: trunk/test/ruby/test_numeric.rb trunk/test/ruby/test_regexp.rb Index: test/ruby/test_numeric.rb =================================================================== --- test/ruby/test_numeric.rb (revision 61192) +++ test/ruby/test_numeric.rb (revision 61193) @@ -22,10 +22,12 @@ 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}"} - 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}"} + 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 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 61192) +++ test/ruby/test_regexp.rb (revision 61193) @@ -667,7 +667,11 @@ 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| assert_raise_with_message(IndexError, /#{idx}/, bug10877) {m[idx]} } + test.call {|m| + EnvUtil.with_default_external(enc) do + assert_raise_with_message(IndexError, /#{idx}/, bug10877) {m[idx]} + end + } 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/