diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2009-10-05 13:38:56 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2009-10-05 13:38:56 -0700 |
commit | 3d54485fc149b65344db0272df0ed1820bbb03f3 (patch) | |
tree | ebeb95f884ca5ac65d56325974fb35395d284e7b /test/visitors | |
parent | 3027b4d69c2fe2e3f4f254e102af3834fddff2f6 (diff) | |
download | psych-3d54485fc149b65344db0272df0ed1820bbb03f3.zip |
supporting dates
Diffstat (limited to 'test/visitors')
-rw-r--r-- | test/visitors/test_to_ruby.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/visitors/test_to_ruby.rb b/test/visitors/test_to_ruby.rb index 7265316..fa7c539 100644 --- a/test/visitors/test_to_ruby.rb +++ b/test/visitors/test_to_ruby.rb @@ -9,6 +9,15 @@ module Psych @visitor = ToRuby.new end + def test_date + d = '1980-12-16' + actual = Date.strptime(d, '%Y-%m-%d') + + date = Nodes::Scalar.new(d, nil, 'tag:yaml.org,2002:timestamp', false) + + assert_equal actual, date.to_ruby + end + def test_rational mapping = Nodes::Mapping.new nil, 'ruby/object:Rational' mapping.children << Nodes::Scalar.new('denominator') |