1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Suppress warnings

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40049 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2013-04-02 02:14:21 +00:00
parent 0fb23a9449
commit 7a77e12488
3 changed files with 21 additions and 26 deletions

View file

@ -3,6 +3,7 @@ require 'stringio'
require 'tempfile'
require 'date'
require 'psych'
require_relative '../ruby/envutil'
module Psych
class TestCase < MiniTest::Unit::TestCase

View file

@ -3,6 +3,7 @@ require_relative 'helper'
module Psych
class TestDeprecated < TestCase
def teardown
$VERBOSE = @orig_verbose
Psych.domain_types.clear
end
@ -27,6 +28,7 @@ module Psych
def setup
@qe = QuickEmitter.new
@orig_verbose, $VERBOSE = $VERBOSE, false
end
def test_quick_emit
@ -145,8 +147,10 @@ module Psych
end
class YamlAs
EnvUtil.suppress_warning do
psych_yaml_as 'helloworld' # this should be yaml_as but to avoid syck
end
end
def test_yaml_as
assert_match(/helloworld/, Psych.dump(YamlAs.new))

View file

@ -114,19 +114,14 @@ module Psych
end
def test_to_yaml_is_valid
ext_before = Encoding.default_external
int_before = Encoding.default_internal
Encoding.default_external = Encoding::US_ASCII
Encoding.default_internal = nil
EnvUtil.with_default_external(Encoding::US_ASCII) do
EnvUtil.with_default_internal(nil) do
s = "こんにちは!"
# If no encoding is specified, use UTF-8
assert_equal Encoding::UTF_8, Psych.dump(s).encoding
assert_equal s, Psych.load(Psych.dump(s))
ensure
Encoding.default_external = ext_before
Encoding.default_internal = int_before
end
end
end
def test_start_mapping
@ -191,19 +186,14 @@ module Psych
end
def test_default_internal
before = Encoding.default_internal
Encoding.default_internal = 'EUC-JP'
EnvUtil.with_default_internal(Encoding::EUC_JP) do
str = "壁に耳あり、障子に目あり"
yaml = "--- #{str}"
assert_equal @utf8, str.encoding
@parser.parse str
assert_encodings Encoding.find('EUC-JP'), @handler.strings
assert_encodings Encoding::EUC_JP, @handler.strings
assert_equal str, @handler.strings.first.encode('UTF-8')
ensure
Encoding.default_internal = before
end
end
def test_scalar