summaryrefslogtreecommitdiff
path: root/test/visitors/test_to_ruby.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2009-10-07 10:58:55 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2009-10-07 10:58:55 -0700
commitd3bfc7a71256f84d4ce1b7e31b032739f02dfb55 (patch)
treedd9ff7addd7c5c2693b37790a676637768030263 /test/visitors/test_to_ruby.rb
parent4d047de2c59b71bbe6b4d438970b2c93012662b4 (diff)
downloadpsych-d3bfc7a71256f84d4ce1b7e31b032739f02dfb55.zip
exceptions move back and forth
Diffstat (limited to 'test/visitors/test_to_ruby.rb')
-rw-r--r--test/visitors/test_to_ruby.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/visitors/test_to_ruby.rb b/test/visitors/test_to_ruby.rb
index 7fd99a4..e8b7a6e 100644
--- a/test/visitors/test_to_ruby.rb
+++ b/test/visitors/test_to_ruby.rb
@@ -11,6 +11,19 @@ module Psych
@visitor = ToRuby.new
end
+ def test_exception
+ exc = Exception.new 'hello'
+
+ mapping = Nodes::Mapping.new nil, '!ruby/exception'
+ mapping.children << Nodes::Scalar.new('message')
+ mapping.children << Nodes::Scalar.new('hello')
+
+ ruby = mapping.to_ruby
+
+ assert_equal exc.class, ruby.class
+ assert_equal exc.message, ruby.message
+ end
+
def test_regexp
node = Nodes::Scalar.new('/foo/', nil, '!ruby/regexp')
assert_equal(/foo/, node.to_ruby)