From 3d54485fc149b65344db0272df0ed1820bbb03f3 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Mon, 5 Oct 2009 13:38:56 -0700 Subject: supporting dates --- test/visitors/test_to_ruby.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test/visitors') 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') -- cgit v1.2.3