summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2009-10-07 15:51:21 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2009-10-07 15:51:21 -0700
commit57c468a5f8bd3ffc1cb93b07db6b823872316a18 (patch)
treedad229aa55917b157c2eba2f76d9da3a7e947866 /test
parent98ce58ac328aca5f5d541c9118b5e4184b916bd3 (diff)
downloadpsych-57c468a5f8bd3ffc1cb93b07db6b823872316a18.zip
fixing float parsing
Diffstat (limited to 'test')
-rw-r--r--test/visitors/test_to_ruby.rb6
-rw-r--r--test/visitors/test_yast_builder.rb5
2 files changed, 11 insertions, 0 deletions
diff --git a/test/visitors/test_to_ruby.rb b/test/visitors/test_to_ruby.rb
index 9c37690..8bf9c91 100644
--- a/test/visitors/test_to_ruby.rb
+++ b/test/visitors/test_to_ruby.rb
@@ -173,6 +173,9 @@ module Psych
i = Nodes::Scalar.new(num, nil, 'tag:yaml.org,2002:float')
assert_equal 1000.3, i.to_ruby
+ i = Nodes::Scalar.new(num, nil, '!float')
+ assert_equal 1000.3, i.to_ruby
+
assert_equal 1000.3, Nodes::Scalar.new(num).to_ruby
end
end
@@ -196,6 +199,9 @@ module Psych
end
def test_float
+ i = Nodes::Scalar.new('12', nil, 'tag:yaml.org,2002:float')
+ assert_equal 12.0, i.to_ruby
+
i = Nodes::Scalar.new('1.2', nil, 'tag:yaml.org,2002:float')
assert_equal 1.2, i.to_ruby
diff --git a/test/visitors/test_yast_builder.rb b/test/visitors/test_yast_builder.rb
index 4730e7d..532ab09 100644
--- a/test/visitors/test_yast_builder.rb
+++ b/test/visitors/test_yast_builder.rb
@@ -8,6 +8,11 @@ module Psych
@v = Visitors::YASTBuilder.new
end
+ def test_struct_const
+ foo = Struct.new("Foo", :bar)
+ assert_round_trip foo.new('bar')
+ end
+
A = Struct.new(:foo)
def test_struct