diff options
author | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-07-03 00:52:43 +0000 |
---|---|---|
committer | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-07-03 00:52:43 +0000 |
commit | 59cad45f9963b359b16c1b9a9324b78e5e0873d5 (patch) | |
tree | b4647cc9b049e7ddcc4df946db04c4ed48ec23d1 /test/psych | |
parent | 6fe92a3cd6b4116580ff7663180407bc0c38030f (diff) | |
download | ruby-59cad45f9963b359b16c1b9a9324b78e5e0873d5.tar.gz |
* 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
Diffstat (limited to 'test/psych')
-rw-r--r-- | test/psych/test_date_time.rb | 17 |
1 files changed, 17 insertions, 0 deletions
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 |