mirror of
https://github.com/ruby/ruby.git
synced 2025-08-23 21:14:23 +02:00
* ext/psych/lib/psych/visitors/to_ruby.rb (resolve_klass): fix the
exception message when attempting to load an unknown class. Thanks nobu! [ruby-dev:41399] * test/psych/test_psych.rb: test for the exception message git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28361 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
da3cdd2ddf
commit
b09ad2b847
3 changed files with 19 additions and 4 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
Sat Jun 19 03:35:58 2010 Aaron Patterson <aaron@tenderlovemaking.com>
|
||||||
|
|
||||||
|
* ext/psych/lib/psych/visitors/to_ruby.rb (resolve_klass): fix the
|
||||||
|
exception message when attempting to load an unknown class. Thanks
|
||||||
|
nobu! [ruby-dev:41399]
|
||||||
|
|
||||||
|
* test/psych/test_psych.rb: test for the exception message
|
||||||
|
|
||||||
Fri Jun 18 10:37:46 2010 NARUSE, Yui <naruse@ruby-lang.org>
|
Fri Jun 18 10:37:46 2010 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
* gc.c (gc_lazy_sweep): clean a warning.
|
* gc.c (gc_lazy_sweep): clean a warning.
|
||||||
|
|
|
@ -246,13 +246,13 @@ module Psych
|
||||||
|
|
||||||
begin
|
begin
|
||||||
path2class(name)
|
path2class(name)
|
||||||
rescue ArgumentError => ex
|
rescue ArgumentError, NameError => ex
|
||||||
name = "Struct::#{name}"
|
|
||||||
unless retried
|
unless retried
|
||||||
retried = true
|
name = "Struct::#{name}"
|
||||||
|
retried = ex
|
||||||
retry
|
retry
|
||||||
end
|
end
|
||||||
raise ex
|
raise retried
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -14,6 +14,13 @@ class TestPsych < Psych::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_non_existing_class_on_deserialize
|
||||||
|
e = assert_raises(ArgumentError) do
|
||||||
|
Psych.load("--- !ruby/object:NonExistent\nfoo: 1")
|
||||||
|
end
|
||||||
|
assert_equal 'undefined class/module NonExistent', e.message
|
||||||
|
end
|
||||||
|
|
||||||
def test_dump_stream
|
def test_dump_stream
|
||||||
things = [22, "foo \n", {}]
|
things = [22, "foo \n", {}]
|
||||||
stream = Psych.dump_stream(*things)
|
stream = Psych.dump_stream(*things)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue