aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/core/time
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2020-05-02 16:03:14 +0200
committerBenoit Daloze <eregontp@gmail.com>2020-05-02 16:03:14 +0200
commitc9213aa864fb8527388679c21f1ea8ce129e2f1a (patch)
treea6ef2403c73ef61a2aaddad6c0f8d9d09e4e6151 /spec/ruby/core/time
parenta68ddf42879005905176bc38285906fe01707aff (diff)
downloadruby-c9213aa864fb8527388679c21f1ea8ce129e2f1a.tar.gz
Update to ruby/spec@d394dfd
Diffstat (limited to 'spec/ruby/core/time')
-rw-r--r--spec/ruby/core/time/shared/to_i.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/spec/ruby/core/time/shared/to_i.rb b/spec/ruby/core/time/shared/to_i.rb
index 03497c700b..06c966b708 100644
--- a/spec/ruby/core/time/shared/to_i.rb
+++ b/spec/ruby/core/time/shared/to_i.rb
@@ -6,4 +6,11 @@ describe :time_to_i, shared: true do
it "doesn't return an actual number of seconds in time" do
Time.at(65.5).send(@method).should == 65
end
+
+ it "rounds fractional seconds toward zero" do
+ t = Time.utc(1960, 1, 1, 0, 0, 0, 999_999)
+
+ t.to_f.to_i.should == -315619199
+ t.to_i.should == -315619200
+ end
end