From f356bd817cc636c6c91d106505a3b09d785b2f32 Mon Sep 17 00:00:00 2001 From: eregon Date: Tue, 12 Dec 2017 22:37:40 +0000 Subject: [PATCH] Use EnvUtil.with_default_external in tests needing it * Reverts part of r54522. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61193 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_numeric.rb | 10 ++++++---- test/ruby/test_regexp.rb | 6 +++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/test/ruby/test_numeric.rb b/test/ruby/test_numeric.rb index 02a6b8f4a8..2731b94a4c 100644 --- a/test/ruby/test_numeric.rb +++ b/test/ruby/test_numeric.rb @@ -22,10 +22,12 @@ class TestNumeric < Test::Unit::TestCase 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" diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb index 85d5b2cdfe..be55e36ede 100644 --- a/test/ruby/test_regexp.rb +++ b/test/ruby/test_regexp.rb @@ -667,7 +667,11 @@ class TestRegexp < Test::Unit::TestCase 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) }