summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2009-09-30 15:08:03 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2009-09-30 15:08:03 -0700
commit9306ea64be1a720a3f237e885137e1689ef054d0 (patch)
tree16f1ddbe51a1697b8d5f2c75fdbd03f00dae8395
parente16d9da05cd2d9f4d1a655d3bd65c3e8e0e21446 (diff)
downloadpsych-9306ea64be1a720a3f237e885137e1689ef054d0.zip
testing integers before floats
-rw-r--r--lib/psych/scalar_scanner.rb2
-rw-r--r--test/visitors/test_yast_builder.rb1
2 files changed, 2 insertions, 1 deletions
diff --git a/lib/psych/scalar_scanner.rb b/lib/psych/scalar_scanner.rb
index e8cd748..20f694d 100644
--- a/lib/psych/scalar_scanner.rb
+++ b/lib/psych/scalar_scanner.rb
@@ -37,8 +37,8 @@ module Psych
[:FLOAT, i]
else
- return [:FLOAT, Float(@string.gsub(/[,_]/, ''))] rescue ArgumentError
return [:INTEGER, Integer(@string.gsub(/[,_]/, ''))] rescue ArgumentError
+ return [:FLOAT, Float(@string.gsub(/[,_]/, ''))] rescue ArgumentError
[:SCALAR, @string]
end
diff --git a/test/visitors/test_yast_builder.rb b/test/visitors/test_yast_builder.rb
index e70713c..9a074e1 100644
--- a/test/visitors/test_yast_builder.rb
+++ b/test/visitors/test_yast_builder.rb
@@ -41,6 +41,7 @@ module Psych
def test_list
assert_round_trip(%w{ a b })
+ assert_round_trip([1, 2.2])
end
def test_symbol