summaryrefslogtreecommitdiff
path: root/test/psych
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-07-10 04:05:52 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-07-10 04:05:52 +0000
commitc13b3808b971e3f59c957324dba039b46f3a9853 (patch)
tree33c79efc5165a3a1cfcb5523a4b129a0572eb7e4 /test/psych
parent12ce5781965faa81fafb7c20d47429111ba50f31 (diff)
merges r28550,r28551,r28554 and r28558 from trunk into ruby_1_9_2.
-- * ext/psych/lib/psych/scalar_scanner.rb: making the code more beautiful. Thanks nobu! -- * ext/psych/lib/psych/visitors/yaml_tree.rb (format_time): nanoseconds require more digits when dumping. Thanks akr! [ruby-core:31047] * test/psych/visitors/test_to_ruby.rb: adjusting tests for nanoseconds -- * test/psych/visitors/test_to_ruby.rb (test_time): time test must respect non-whole timezone. Thanks akr! [ruby-core:31061] -- * ext/psych/lib/psych/scalar_scanner.rb (parse_time): dealing with negative partial hour time zones. [ruby-core:31064] * ext/psych/lib/psych/visitors/yaml_tree.rb: ditto * test/psych/visitors/test_to_ruby.rb: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@28602 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/psych')
-rw-r--r--test/psych/visitors/test_to_ruby.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/test/psych/visitors/test_to_ruby.rb b/test/psych/visitors/test_to_ruby.rb
index eb2841d9d0..b5b8e1443d 100644
--- a/test/psych/visitors/test_to_ruby.rb
+++ b/test/psych/visitors/test_to_ruby.rb
@@ -112,8 +112,10 @@ description:
def test_time
now = Time.now
- formatted = now.strftime("%Y-%m-%d %H:%M:%S") +
- ".%06d %+.2d:00" % [now.nsec, now.gmt_offset / 3600]
+ zone = now.strftime('%z')
+ zone = " #{zone[0,3]}:#{zone[3,5]}"
+
+ formatted = now.strftime("%Y-%m-%d %H:%M:%S.%9N") + zone
assert_equal now, Nodes::Scalar.new(formatted).to_ruby
end
@@ -121,7 +123,7 @@ description:
def test_time_utc
now = Time.now.utc
formatted = now.strftime("%Y-%m-%d %H:%M:%S") +
- ".%06dZ" % [now.nsec]
+ ".%09dZ" % [now.nsec]
assert_equal now, Nodes::Scalar.new(formatted).to_ruby
end
@@ -129,7 +131,7 @@ description:
def test_time_utc_no_z
now = Time.now.utc
formatted = now.strftime("%Y-%m-%d %H:%M:%S") +
- ".%06d" % [now.nsec]
+ ".%09d" % [now.nsec]
assert_equal now, Nodes::Scalar.new(formatted).to_ruby
end