summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-07-10 04:01:24 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-07-10 04:01:24 +0000
commit5d2b9ea577538ab76a3c48f5bf38f4eefd149132 (patch)
tree54b975308323377bb9ea7044885849f5498ee47e /test
parent48e4c275f20041316bd6df4fc4ed0e8c5243f7d8 (diff)
merges r28531 from trunk into ruby_1_9_2.
-- * ext/psych/lib/psych/visitors/yaml_tree.rb (visit_Time): use Time#nsec to accurately serialize time objects. [ruby-core:29233] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@28598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/psych/visitors/test_to_ruby.rb12
-rw-r--r--test/psych/visitors/test_yaml_tree.rb2
2 files changed, 7 insertions, 7 deletions
diff --git a/test/psych/visitors/test_to_ruby.rb b/test/psych/visitors/test_to_ruby.rb
index 8ad41dbe7d..eb2841d9d0 100644
--- a/test/psych/visitors/test_to_ruby.rb
+++ b/test/psych/visitors/test_to_ruby.rb
@@ -113,25 +113,25 @@ description:
def test_time
now = Time.now
formatted = now.strftime("%Y-%m-%d %H:%M:%S") +
- ".%06d %+.2d:00" % [now.usec, now.gmt_offset / 3600]
+ ".%06d %+.2d:00" % [now.nsec, now.gmt_offset / 3600]
- assert_in_delta now, Nodes::Scalar.new(formatted).to_ruby, 0.000001
+ assert_equal now, Nodes::Scalar.new(formatted).to_ruby
end
def test_time_utc
now = Time.now.utc
formatted = now.strftime("%Y-%m-%d %H:%M:%S") +
- ".%06dZ" % [now.usec]
+ ".%06dZ" % [now.nsec]
- assert_in_delta now, Nodes::Scalar.new(formatted).to_ruby, 0.000001
+ assert_equal now, Nodes::Scalar.new(formatted).to_ruby
end
def test_time_utc_no_z
now = Time.now.utc
formatted = now.strftime("%Y-%m-%d %H:%M:%S") +
- ".%06d" % [now.usec]
+ ".%06d" % [now.nsec]
- assert_in_delta now, Nodes::Scalar.new(formatted).to_ruby, 0.000001
+ assert_equal now, Nodes::Scalar.new(formatted).to_ruby
end
def test_date
diff --git a/test/psych/visitors/test_yaml_tree.rb b/test/psych/visitors/test_yaml_tree.rb
index 758cfaed72..ed89e78600 100644
--- a/test/psych/visitors/test_yaml_tree.rb
+++ b/test/psych/visitors/test_yaml_tree.rb
@@ -54,7 +54,7 @@ module Psych
def test_time
t = Time.now
- assert_in_delta t, Psych.load(Psych.dump(t)), 0.000001
+ assert_equal t, Psych.load(Psych.dump(t))
end
def test_date