summaryrefslogtreecommitdiff
path: root/test/psych/test_exception.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/psych/test_exception.rb')
-rw-r--r--test/psych/test_exception.rb26
1 files changed, 22 insertions, 4 deletions
diff --git a/test/psych/test_exception.rb b/test/psych/test_exception.rb
index 3040bfb7a2..3c72f4a97a 100644
--- a/test/psych/test_exception.rb
+++ b/test/psych/test_exception.rb
@@ -30,9 +30,15 @@ module Psych
assert_nil ex.file
ex = assert_raises(Psych::SyntaxError) do
- Psych.load '--- `', 'meow'
+ Psych.load '--- `', filename: 'meow'
end
assert_equal 'meow', ex.file
+
+ # deprecated interface
+ ex = assert_raises(Psych::SyntaxError) do
+ Psych.load '--- `', 'deprecated'
+ end
+ assert_equal 'deprecated', ex.file
end
def test_psych_parse_stream_takes_file
@@ -43,7 +49,7 @@ module Psych
assert_match '(<unknown>)', ex.message
ex = assert_raises(Psych::SyntaxError) do
- Psych.parse_stream '--- `', 'omg!'
+ Psych.parse_stream '--- `', filename: 'omg!'
end
assert_equal 'omg!', ex.file
assert_match 'omg!', ex.message
@@ -57,9 +63,15 @@ module Psych
assert_match '(<unknown>)', ex.message
ex = assert_raises(Psych::SyntaxError) do
- Psych.load_stream '--- `', 'omg!'
+ Psych.load_stream '--- `', filename: 'omg!'
end
assert_equal 'omg!', ex.file
+
+ # deprecated interface
+ ex = assert_raises(Psych::SyntaxError) do
+ Psych.load_stream '--- `', 'deprecated'
+ end
+ assert_equal 'deprecated', ex.file
end
def test_parse_file_exception
@@ -94,9 +106,15 @@ module Psych
assert_nil ex.file
ex = assert_raises(Psych::SyntaxError) do
- Psych.parse '--- `', 'omg!'
+ Psych.parse '--- `', filename: 'omg!'
end
assert_match 'omg!', ex.message
+
+ # deprecated interface
+ ex = assert_raises(Psych::SyntaxError) do
+ Psych.parse '--- `', 'deprecated'
+ end
+ assert_match 'deprecated', ex.message
end
def test_attributes