diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-03-11 08:29:46 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-03-11 08:29:46 +0000 |
commit | 7590de68e2102d586a1fb4e34642643b3c731269 (patch) | |
tree | c1d6f0123a404cf538bb353e36889d0fd5865aab /test/ruby/envutil.rb | |
parent | 756cd2852d8faea5139b01bfd5e596d6f9e35b14 (diff) |
* test/ruby/envutil.rb (EnvUtil.with_default_external): add for
changing Encoding.default_external without warnings.
* test/ruby/envutil.rb (EnvUtil.with_default_internal): ditto.
* test/ruby/test_io_m17n.rb: use above with_default_external.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39721 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/envutil.rb')
-rw-r--r-- | test/ruby/envutil.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/ruby/envutil.rb b/test/ruby/envutil.rb index a8f3874e9f..98b89edd8c 100644 --- a/test/ruby/envutil.rb +++ b/test/ruby/envutil.rb @@ -127,6 +127,30 @@ module EnvUtil GC.stress = stress end module_function :under_gc_stress + + def with_default_external(enc) + verbose, $VERBOSE = $VERBOSE, nil + origenc, Encoding.default_external = Encoding.default_external, enc + $VERBOSE = verbose + yield + ensure + verbose, $VERBOSE = $VERBOSE, nil + Encoding.default_external = origenc + $VERBOSE = verbose + end + module_function :with_default_external + + def with_default_internal(enc) + verbose, $VERBOSE = $VERBOSE, nil + origenc, Encoding.default_internal = Encoding.default_internal, enc + $VERBOSE = verbose + yield + ensure + verbose, $VERBOSE = $VERBOSE, nil + Encoding.default_internal = origenc + $VERBOSE = verbose + end + module_function :with_default_internal end module Test |