diff options
author | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-12-01 15:41:50 +0000 |
---|---|---|
committer | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-12-01 15:41:50 +0000 |
commit | 4d7b0b9112f2adf9e87ef75056f930bf7c1f3dc4 (patch) | |
tree | 8d712e18a619a9720d181d0d44e8cc2474ff31ee /spec/ruby/core/time | |
parent | 821d9a2d30f2e0d3f9009dc001b4b49aaa63c66e (diff) | |
download | ruby-4d7b0b9112f2adf9e87ef75056f930bf7c1f3dc4.tar.gz |
Update to ruby/spec@bacedc5
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60973 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/ruby/core/time')
-rw-r--r-- | spec/ruby/core/time/round_spec.rb | 6 | ||||
-rw-r--r-- | spec/ruby/core/time/shared/gm.rb | 7 |
2 files changed, 11 insertions, 2 deletions
diff --git a/spec/ruby/core/time/round_spec.rb b/spec/ruby/core/time/round_spec.rb index a9a793c156..97568802b9 100644 --- a/spec/ruby/core/time/round_spec.rb +++ b/spec/ruby/core/time/round_spec.rb @@ -3,7 +3,6 @@ require File.expand_path('../../../spec_helper', __FILE__) describe "Time#round" do before do @time = Time.utc(2010, 3, 30, 5, 43, "25.123456789".to_r) - @subclass = Class.new(Time).now end it "defaults to rounding to 0 places" do @@ -19,7 +18,10 @@ describe "Time#round" do end it "returns an instance of Time, even if #round is called on a subclass" do - @subclass.round.should be_an_instance_of(Time) + subclass = Class.new(Time) + instance = subclass.at(0) + instance.class.should equal subclass + instance.round.should be_an_instance_of(Time) end it "copies own timezone to the returning value" do diff --git a/spec/ruby/core/time/shared/gm.rb b/spec/ruby/core/time/shared/gm.rb index 805e35766c..72012caa66 100644 --- a/spec/ruby/core/time/shared/gm.rb +++ b/spec/ruby/core/time/shared/gm.rb @@ -19,4 +19,11 @@ describe :time_gm, shared: true do it "interprets post-Gregorian reform dates using Gregorian calendar" do Time.send(@method, 1582, 10, 15, 12).to_i.should == -12219249600 # 2299161j end + + it "handles fractional usec close to rounding limit" do + time = Time.send(@method, 2000, 1, 1, 12, 30, 0, 9999r/10000) + + time.usec.should == 0 + time.nsec.should == 999 + end end |