diff options
Diffstat (limited to 'test/visitors/test_yast_builder.rb')
-rw-r--r-- | test/visitors/test_yast_builder.rb | 18 |
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 |