summaryrefslogtreecommitdiff
path: root/test/visitors/test_to_ruby.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2009-09-30 14:32:35 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2009-09-30 14:32:35 -0700
commit0fdc41a6e3ab790e58db0e0f54affe5d2a8277f2 (patch)
tree023b528b6e33f4756c03960fccf96b8258ee9790 /test/visitors/test_to_ruby.rb
parent211251bab57a5535e47832b75176096e087c89b0 (diff)
downloadpsych-0fdc41a6e3ab790e58db0e0f54affe5d2a8277f2.zip
using the same logic for string emitting and parsing
Diffstat (limited to 'test/visitors/test_to_ruby.rb')
-rw-r--r--test/visitors/test_to_ruby.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/visitors/test_to_ruby.rb b/test/visitors/test_to_ruby.rb
index 6facc68..0dafbd8 100644
--- a/test/visitors/test_to_ruby.rb
+++ b/test/visitors/test_to_ruby.rb
@@ -21,6 +21,24 @@ module Psych
assert_equal 1, Nodes::Scalar.new('+1').to_ruby
end
+ def test_int_ignore
+ ['1,000', '1_000'].each do |num|
+ i = Nodes::Scalar.new(num, nil, 'tag:yaml.org,2002:int')
+ assert_equal 1000, i.to_ruby
+
+ assert_equal 1000, Nodes::Scalar.new(num).to_ruby
+ end
+ end
+
+ def test_float_ignore
+ ['1,000.3', '1_000.3'].each do |num|
+ i = Nodes::Scalar.new(num, nil, 'tag:yaml.org,2002:float')
+ assert_equal 1000.3, i.to_ruby
+
+ assert_equal 1000.3, Nodes::Scalar.new(num).to_ruby
+ end
+ end
+
def test_float
i = Nodes::Scalar.new('1.2', nil, 'tag:yaml.org,2002:float')
assert_equal 1.2, i.to_ruby