From 59cad45f9963b359b16c1b9a9324b78e5e0873d5 Mon Sep 17 00:00:00 2001 From: tenderlove Date: Sat, 3 Jul 2010 00:52:43 +0000 Subject: * ext/psych/lib/psych/visitors/to_ruby.rb(visit_Psych_Nodes_Scalar): teaching Psych to deserialize DateTime objects. [Bug #1390] * ext/psych/lib/psych/visitors/yaml_tree.rb(visit_DateTime): added a method for serializing DateTime objects. * ext/psych/lib/psych/scalar_scanner.rb(parse_time): add method for parsing times objects from a string. * test/psych/test_date_time.rb: tests for dumping DateTime objects. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/psych/test_date_time.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 test/psych/test_date_time.rb (limited to 'test/psych/test_date_time.rb') diff --git a/test/psych/test_date_time.rb b/test/psych/test_date_time.rb new file mode 100644 index 0000000000..df66d142f6 --- /dev/null +++ b/test/psych/test_date_time.rb @@ -0,0 +1,17 @@ +require_relative 'helper' +require 'date' + +module Psych + class TestDateTime < TestCase + def test_string_tag + dt = DateTime.now + yaml = Psych.dump dt + assert_match(/DateTime/, yaml) + end + + def test_round_trip + dt = DateTime.now + assert_cycle dt + end + end +end -- cgit v1.2.3