summaryrefslogtreecommitdiff
path: root/test/psych
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2013-04-05 09:51:22 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2013-04-05 09:51:37 -0700
commitb4537454d9da6e901dcacf4c4e36de08095f79a3 (patch)
tree1314057947f05586c03d40b3342ef406b61e58c6 /test/psych
parentedf05c9f40e0c566e391f7e04b4a30327c31a828 (diff)
downloadpsych-b4537454d9da6e901dcacf4c4e36de08095f79a3.zip
sync with ruby trunk
Diffstat (limited to 'test/psych')
-rw-r--r--test/psych/helper.rb1
-rw-r--r--test/psych/test_alias_and_anchor.rb2
-rw-r--r--test/psych/test_array.rb2
-rw-r--r--test/psych/test_boolean.rb2
-rw-r--r--test/psych/test_class.rb2
-rw-r--r--test/psych/test_coder.rb2
-rw-r--r--test/psych/test_date_time.rb2
-rw-r--r--test/psych/test_deprecated.rb8
-rw-r--r--test/psych/test_document.rb2
-rw-r--r--test/psych/test_emitter.rb2
-rw-r--r--test/psych/test_encoding.rb42
-rw-r--r--test/psych/test_engine_manager.rb2
-rw-r--r--test/psych/test_exception.rb2
-rw-r--r--test/psych/test_hash.rb2
-rw-r--r--test/psych/test_json_tree.rb2
-rw-r--r--test/psych/test_merge_keys.rb2
-rw-r--r--test/psych/test_nil.rb2
-rw-r--r--test/psych/test_null.rb2
-rw-r--r--test/psych/test_numeric.rb2
-rw-r--r--test/psych/test_object.rb2
-rw-r--r--test/psych/test_object_references.rb2
-rw-r--r--test/psych/test_omap.rb2
-rw-r--r--test/psych/test_parser.rb2
-rw-r--r--test/psych/test_psych.rb3
-rw-r--r--test/psych/test_scalar.rb2
-rw-r--r--test/psych/test_scalar_scanner.rb2
-rw-r--r--test/psych/test_serialize_subclasses.rb2
-rw-r--r--test/psych/test_set.rb2
-rw-r--r--test/psych/test_stream.rb2
-rw-r--r--test/psych/test_string.rb2
-rw-r--r--test/psych/test_struct.rb2
-rw-r--r--test/psych/test_symbol.rb2
-rw-r--r--test/psych/test_tainted.rb2
-rw-r--r--test/psych/test_to_yaml_properties.rb2
-rw-r--r--test/psych/test_tree_builder.rb2
-rw-r--r--test/psych/test_yaml.rb2
-rw-r--r--test/psych/test_yamldbm.rb2
-rw-r--r--test/psych/test_yamlstore.rb2
38 files changed, 59 insertions, 63 deletions
diff --git a/test/psych/helper.rb b/test/psych/helper.rb
index f580030..0aae699 100644
--- a/test/psych/helper.rb
+++ b/test/psych/helper.rb
@@ -3,6 +3,7 @@ require 'stringio'
require 'tempfile'
require 'date'
require 'psych'
+require_relative '../ruby/envutil'
module Psych
class TestCase < MiniTest::Unit::TestCase
diff --git a/test/psych/test_alias_and_anchor.rb b/test/psych/test_alias_and_anchor.rb
index 7cb5a6e..9e2c240 100644
--- a/test/psych/test_alias_and_anchor.rb
+++ b/test/psych/test_alias_and_anchor.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
class ObjectWithInstanceVariables
attr_accessor :var1, :var2
diff --git a/test/psych/test_array.rb b/test/psych/test_array.rb
index 747fe95..960ffd7 100644
--- a/test/psych/test_array.rb
+++ b/test/psych/test_array.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestArray < TestCase
diff --git a/test/psych/test_boolean.rb b/test/psych/test_boolean.rb
index ebfa25e..b656f4f 100644
--- a/test/psych/test_boolean.rb
+++ b/test/psych/test_boolean.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
###
diff --git a/test/psych/test_class.rb b/test/psych/test_class.rb
index 156f2fb..c7f964c 100644
--- a/test/psych/test_class.rb
+++ b/test/psych/test_class.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestClass < TestCase
diff --git a/test/psych/test_coder.rb b/test/psych/test_coder.rb
index 7539c7d..4809b13 100644
--- a/test/psych/test_coder.rb
+++ b/test/psych/test_coder.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestCoder < TestCase
diff --git a/test/psych/test_date_time.rb b/test/psych/test_date_time.rb
index fb76cb3..df66d14 100644
--- a/test/psych/test_date_time.rb
+++ b/test/psych/test_date_time.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
require 'date'
module Psych
diff --git a/test/psych/test_deprecated.rb b/test/psych/test_deprecated.rb
index 3740b6f..1d853e1 100644
--- a/test/psych/test_deprecated.rb
+++ b/test/psych/test_deprecated.rb
@@ -1,8 +1,9 @@
-require 'psych/helper'
+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,7 +147,9 @@ module Psych
end
class YamlAs
- psych_yaml_as 'helloworld' # this should be yaml_as but to avoid syck
+ EnvUtil.suppress_warning do
+ psych_yaml_as 'helloworld' # this should be yaml_as but to avoid syck
+ end
end
def test_yaml_as
diff --git a/test/psych/test_document.rb b/test/psych/test_document.rb
index 05d9bbf..bd77d60 100644
--- a/test/psych/test_document.rb
+++ b/test/psych/test_document.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestDocument < TestCase
diff --git a/test/psych/test_emitter.rb b/test/psych/test_emitter.rb
index dfd20e1..0554ae5 100644
--- a/test/psych/test_emitter.rb
+++ b/test/psych/test_emitter.rb
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestEmitter < TestCase
diff --git a/test/psych/test_encoding.rb b/test/psych/test_encoding.rb
index 1abee0d..2cddd59 100644
--- a/test/psych/test_encoding.rb
+++ b/test/psych/test_encoding.rb
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestEncoding < TestCase
@@ -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
-
- 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
+ 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))
+ 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 = "壁に耳あり、障子に目あり"
+ assert_equal @utf8, str.encoding
- str = "壁に耳あり、障子に目あり"
- yaml = "--- #{str}"
- assert_equal @utf8, str.encoding
-
- @parser.parse str
- assert_encodings Encoding.find('EUC-JP'), @handler.strings
- assert_equal str, @handler.strings.first.encode('UTF-8')
- ensure
- Encoding.default_internal = before
+ @parser.parse str
+ assert_encodings Encoding::EUC_JP, @handler.strings
+ assert_equal str, @handler.strings.first.encode('UTF-8')
+ end
end
def test_scalar
diff --git a/test/psych/test_engine_manager.rb b/test/psych/test_engine_manager.rb
index e7bfb2e..33a6743 100644
--- a/test/psych/test_engine_manager.rb
+++ b/test/psych/test_engine_manager.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
require 'yaml'
module Psych
diff --git a/test/psych/test_exception.rb b/test/psych/test_exception.rb
index 46dece4..d54c7d4 100644
--- a/test/psych/test_exception.rb
+++ b/test/psych/test_exception.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestException < TestCase
diff --git a/test/psych/test_hash.rb b/test/psych/test_hash.rb
index 4bd4edf..dac7f8d 100644
--- a/test/psych/test_hash.rb
+++ b/test/psych/test_hash.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestHash < TestCase
diff --git a/test/psych/test_json_tree.rb b/test/psych/test_json_tree.rb
index eed8cf3..60f8321 100644
--- a/test/psych/test_json_tree.rb
+++ b/test/psych/test_json_tree.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestJSONTree < TestCase
diff --git a/test/psych/test_merge_keys.rb b/test/psych/test_merge_keys.rb
index c31f9b8..d8baba4 100644
--- a/test/psych/test_merge_keys.rb
+++ b/test/psych/test_merge_keys.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestMergeKeys < TestCase
diff --git a/test/psych/test_nil.rb b/test/psych/test_nil.rb
index 4f32b77..3dbf562 100644
--- a/test/psych/test_nil.rb
+++ b/test/psych/test_nil.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestNil < TestCase
diff --git a/test/psych/test_null.rb b/test/psych/test_null.rb
index 0fee1d2..1725550 100644
--- a/test/psych/test_null.rb
+++ b/test/psych/test_null.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
###
diff --git a/test/psych/test_numeric.rb b/test/psych/test_numeric.rb
index 0858e79..5378b4a 100644
--- a/test/psych/test_numeric.rb
+++ b/test/psych/test_numeric.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
require 'bigdecimal'
module Psych
diff --git a/test/psych/test_object.rb b/test/psych/test_object.rb
index 6145bb6..5e3ce82 100644
--- a/test/psych/test_object.rb
+++ b/test/psych/test_object.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
class Tagged
diff --git a/test/psych/test_object_references.rb b/test/psych/test_object_references.rb
index 51d8085..9e2cf08 100644
--- a/test/psych/test_object_references.rb
+++ b/test/psych/test_object_references.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestObjectReferences < TestCase
diff --git a/test/psych/test_omap.rb b/test/psych/test_omap.rb
index 34df724..36edc26 100644
--- a/test/psych/test_omap.rb
+++ b/test/psych/test_omap.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestOmap < TestCase
diff --git a/test/psych/test_parser.rb b/test/psych/test_parser.rb
index acbdd96..0abe0dd 100644
--- a/test/psych/test_parser.rb
+++ b/test/psych/test_parser.rb
@@ -1,6 +1,6 @@
# coding: utf-8
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestParser < TestCase
diff --git a/test/psych/test_psych.rb b/test/psych/test_psych.rb
index 66b020a..96dde9d 100644
--- a/test/psych/test_psych.rb
+++ b/test/psych/test_psych.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
require 'stringio'
require 'tempfile'
@@ -68,6 +68,7 @@ class TestPsych < Psych::TestCase
assert_equal io, Psych.dump(hash, io)
io.rewind
assert_equal Psych.dump(hash), io.read
+ io.close(true)
end
end
diff --git a/test/psych/test_scalar.rb b/test/psych/test_scalar.rb
index 3cf6b09..e6b7697 100644
--- a/test/psych/test_scalar.rb
+++ b/test/psych/test_scalar.rb
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestScalar < TestCase
diff --git a/test/psych/test_scalar_scanner.rb b/test/psych/test_scalar_scanner.rb
index 8483eab..a7bf17c 100644
--- a/test/psych/test_scalar_scanner.rb
+++ b/test/psych/test_scalar_scanner.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
require 'date'
module Psych
diff --git a/test/psych/test_serialize_subclasses.rb b/test/psych/test_serialize_subclasses.rb
index c822192..f597b7a 100644
--- a/test/psych/test_serialize_subclasses.rb
+++ b/test/psych/test_serialize_subclasses.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestSerializeSubclasses < TestCase
diff --git a/test/psych/test_set.rb b/test/psych/test_set.rb
index bea67d9..921fe22 100644
--- a/test/psych/test_set.rb
+++ b/test/psych/test_set.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestSet < TestCase
diff --git a/test/psych/test_stream.rb b/test/psych/test_stream.rb
index beca365..7e41178 100644
--- a/test/psych/test_stream.rb
+++ b/test/psych/test_stream.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestStream < TestCase
diff --git a/test/psych/test_string.rb b/test/psych/test_string.rb
index aa6866b..a298831 100644
--- a/test/psych/test_string.rb
+++ b/test/psych/test_string.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestString < TestCase
diff --git a/test/psych/test_struct.rb b/test/psych/test_struct.rb
index 977aae0..8c7f251 100644
--- a/test/psych/test_struct.rb
+++ b/test/psych/test_struct.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
class PsychStructWithIvar < Struct.new(:foo)
attr_reader :bar
diff --git a/test/psych/test_symbol.rb b/test/psych/test_symbol.rb
index 3226141..2b4470d 100644
--- a/test/psych/test_symbol.rb
+++ b/test/psych/test_symbol.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestSymbol < TestCase
diff --git a/test/psych/test_tainted.rb b/test/psych/test_tainted.rb
index fdcced4..62872b0 100644
--- a/test/psych/test_tainted.rb
+++ b/test/psych/test_tainted.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestStringTainted < TestCase
diff --git a/test/psych/test_to_yaml_properties.rb b/test/psych/test_to_yaml_properties.rb
index 2636bec..5b4860c 100644
--- a/test/psych/test_to_yaml_properties.rb
+++ b/test/psych/test_to_yaml_properties.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestToYamlProperties < MiniTest::Unit::TestCase
diff --git a/test/psych/test_tree_builder.rb b/test/psych/test_tree_builder.rb
index 9a134d5..7ad3ddd 100644
--- a/test/psych/test_tree_builder.rb
+++ b/test/psych/test_tree_builder.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestTreeBuilder < TestCase
diff --git a/test/psych/test_yaml.rb b/test/psych/test_yaml.rb
index 9891349..ba86807 100644
--- a/test/psych/test_yaml.rb
+++ b/test/psych/test_yaml.rb
@@ -2,7 +2,7 @@
# vim:sw=4:ts=4
# $Id$
#
-require 'psych/helper'
+require_relative 'helper'
require 'ostruct'
# [ruby-core:01946]
diff --git a/test/psych/test_yamldbm.rb b/test/psych/test_yamldbm.rb
index d978003..dba9eee 100644
--- a/test/psych/test_yamldbm.rb
+++ b/test/psych/test_yamldbm.rb
@@ -1,6 +1,6 @@
# -*- coding: UTF-8 -*-
-require 'psych/helper'
+require_relative 'helper'
require 'tmpdir'
begin
diff --git a/test/psych/test_yamlstore.rb b/test/psych/test_yamlstore.rb
index 5d6fcb7..19471b1 100644
--- a/test/psych/test_yamlstore.rb
+++ b/test/psych/test_yamlstore.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
require 'yaml/store'
require 'tmpdir'