summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2009-09-29 19:58:28 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2009-09-29 19:58:28 -0700
commitf7a4949ef5ba75348843ecc0564f284675c7be2e (patch)
treee5fed2e840549ce2f0907c13d51e9c5b7529199f /test
parent96fd76f74b6eaa1620b321c8e55ce3c9675239f0 (diff)
downloadpsych-f7a4949ef5ba75348843ecc0564f284675c7be2e.zip
anonymous classes
Diffstat (limited to 'test')
-rw-r--r--test/visitors/test_yast_builder.rb18
1 files changed, 15 insertions, 3 deletions
diff --git a/test/visitors/test_yast_builder.rb b/test/visitors/test_yast_builder.rb
index 02f4c91..e73a57b 100644
--- a/test/visitors/test_yast_builder.rb
+++ b/test/visitors/test_yast_builder.rb
@@ -4,11 +4,13 @@ require 'psych'
module Psych
module Visitors
class TestYASTBuilder < MiniTest::Unit::TestCase
+ def setup
+ @v = Visitors::YASTBuilder.new
+ end
def test_scalar
- v = Visitors::YASTBuilder.new
- v.accept 'foo'
+ @v.accept 'foo'
- assert_equal 'foo', Psych.load(v.tree.to_yaml)
+ assert_equal 'foo', Psych.load(@v.tree.to_yaml)
assert_equal 'foo', Psych.load('foo'.to_yaml)
end
@@ -16,6 +18,16 @@ module Psych
string = [0, 123,22, 44, 9, 32, 34, 39].pack('C*')
assert_equal string, Psych.load(string.to_yaml)
end
+
+ def test_anon_class
+ assert_raises(TypeError) do
+ @v.accept Class.new
+ end
+
+ assert_raises(TypeError) do
+ Class.new.to_yaml
+ end
+ end
end
end
end