aboutsummaryrefslogtreecommitdiffstats
path: root/test/psych/helper.rb
diff options
context:
space:
mode:
authortenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-05-14 17:07:51 +0000
committertenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-05-14 17:07:51 +0000
commitd7f06a665c8e5b4ec83b6baa4a7532fc7ad7f24a (patch)
tree69cdc9936dcf7a24515547ab11dc263a4cc6f887 /test/psych/helper.rb
parent0b8f727d7b3cd162ccba570d17ebf1ae72bd120a (diff)
downloadruby-d7f06a665c8e5b4ec83b6baa4a7532fc7ad7f24a.tar.gz
* test/psych/helper.rb: envutil is not available outside Ruby, so
port the functions from envutil to the test helper. * test/psych/test_deprecated.rb: ditto * test/psych/test_encoding.rb: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40749 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/psych/helper.rb')
-rw-r--r--test/psych/helper.rb30
1 files changed, 29 insertions, 1 deletions
diff --git a/test/psych/helper.rb b/test/psych/helper.rb
index 0aae69971e..77ab0bb9d7 100644
--- a/test/psych/helper.rb
+++ b/test/psych/helper.rb
@@ -3,10 +3,38 @@ require 'stringio'
require 'tempfile'
require 'date'
require 'psych'
-require_relative '../ruby/envutil'
module Psych
class TestCase < MiniTest::Unit::TestCase
+ def self.suppress_warning
+ verbose, $VERBOSE = $VERBOSE, nil
+ yield
+ ensure
+ $VERBOSE = verbose
+ end
+
+ 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
+
+ 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
+
#
# Convert between Psych and the object to verify correct parsing and
# emitting