diff options
author | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-04-28 19:50:06 +0000 |
---|---|---|
committer | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-04-28 19:50:06 +0000 |
commit | 4fbb9aa3cb6c31ec128bfb31f59efa66d66adba4 (patch) | |
tree | 84a654b260261fe172f2584f60b3ba93e59f841d /spec/ruby/optional | |
parent | b864bd05bff2a61d55b08deb92e969f9fa55e07c (diff) |
Update to ruby/spec@6f38a82
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63293 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/ruby/optional')
-rw-r--r-- | spec/ruby/optional/capi/class_spec.rb | 36 | ||||
-rw-r--r-- | spec/ruby/optional/capi/time_spec.rb | 60 |
2 files changed, 39 insertions, 57 deletions
diff --git a/spec/ruby/optional/capi/class_spec.rb b/spec/ruby/optional/capi/class_spec.rb index 85d7419fd2..acfb8e3728 100644 --- a/spec/ruby/optional/capi/class_spec.rb +++ b/spec/ruby/optional/capi/class_spec.rb @@ -257,34 +257,20 @@ describe "C-API Class function" do }.should raise_error(TypeError) end - ruby_version_is "2.3" do - it "raises a TypeError when given a mismatched class to superclass" do - CApiClassSpecs::ClassUnder6 = Class.new(CApiClassSpecs::Super) - lambda { @s.rb_define_class_under(CApiClassSpecs, - "ClassUnder6", - Class.new) - }.should raise_error(TypeError) - end - end - - ruby_version_is ""..."2.3" do - it "raises a NameError when given a mismatched class to superclass" do - CApiClassSpecs::ClassUnder6 = Class.new(CApiClassSpecs::Super) - lambda { @s.rb_define_class_under(CApiClassSpecs, - "ClassUnder6", - Class.new) - }.should raise_error(NameError) - end + it "raises a TypeError when given a mismatched class to superclass" do + CApiClassSpecs::ClassUnder6 = Class.new(CApiClassSpecs::Super) + lambda { @s.rb_define_class_under(CApiClassSpecs, + "ClassUnder6", + Class.new) + }.should raise_error(TypeError) end it "defines a class for an existing Autoload" do ClassUnderAutoload.name.should == "ClassUnderAutoload" end - ruby_version_is "2.3" do - it "raises a TypeError if class is defined and its superclass mismatches the given one" do - lambda { @s.rb_define_class_under(CApiClassSpecs, "Sub", Object) }.should raise_error(TypeError) - end + it "raises a TypeError if class is defined and its superclass mismatches the given one" do + lambda { @s.rb_define_class_under(CApiClassSpecs, "Sub", Object) }.should raise_error(TypeError) end end @@ -310,10 +296,8 @@ describe "C-API Class function" do ClassIdUnderAutoload.name.should == "ClassIdUnderAutoload" end - ruby_version_is "2.3" do - it "raises a TypeError if class is defined and its superclass mismatches the given one" do - lambda { @s.rb_define_class_id_under(CApiClassSpecs, :Sub, Object) }.should raise_error(TypeError) - end + it "raises a TypeError if class is defined and its superclass mismatches the given one" do + lambda { @s.rb_define_class_id_under(CApiClassSpecs, :Sub, Object) }.should raise_error(TypeError) end end diff --git a/spec/ruby/optional/capi/time_spec.rb b/spec/ruby/optional/capi/time_spec.rb index 7cc1c642b0..4a59c98100 100644 --- a/spec/ruby/optional/capi/time_spec.rb +++ b/spec/ruby/optional/capi/time_spec.rb @@ -258,45 +258,43 @@ describe "CApiTimeSpecs" do end end - ruby_version_is "2.3" do - describe "rb_time_timespec_new" do - it "returns a time object with the given timespec and UTC offset" do - @s.rb_time_timespec_new(1447087832, 476451125, 32400).should == Time.at(1447087832, 476451.125).localtime(32400) - end - - describe "when offset given is within range of -86400 and 86400 (exclusive)" do - it "sets time's is_gmt to false" do - @s.rb_time_timespec_new(1447087832, 476451125, 0).gmt?.should be_false - end + describe "rb_time_timespec_new" do + it "returns a time object with the given timespec and UTC offset" do + @s.rb_time_timespec_new(1447087832, 476451125, 32400).should == Time.at(1447087832, 476451.125).localtime(32400) + end - it "sets time's offset to the offset given" do - @s.rb_time_timespec_new(1447087832, 476451125, 86399).gmtoff.should == 86399 - end + describe "when offset given is within range of -86400 and 86400 (exclusive)" do + it "sets time's is_gmt to false" do + @s.rb_time_timespec_new(1447087832, 476451125, 0).gmt?.should be_false end - it "returns time object in UTC if offset given equals INT_MAX - 1" do - @s.rb_time_timespec_new(1447087832, 476451125, 0x7ffffffe).utc?.should be_true + it "sets time's offset to the offset given" do + @s.rb_time_timespec_new(1447087832, 476451125, 86399).gmtoff.should == 86399 end + end - it "returns time object in localtime if offset given equals INT_MAX" do - @s.rb_time_timespec_new(1447087832, 476451125, 0x7fffffff).should == Time.at(1447087832, 476451.125).localtime - t = Time.now - @s.rb_time_timespec_new(t.tv_sec, t.tv_nsec, 0x7fffffff).gmtoff.should == t.gmtoff - end + it "returns time object in UTC if offset given equals INT_MAX - 1" do + @s.rb_time_timespec_new(1447087832, 476451125, 0x7ffffffe).utc?.should be_true + end - it "raises an ArgumentError if offset passed is not within range of -86400 and 86400 (exclusive)" do - lambda { @s.rb_time_timespec_new(1447087832, 476451125, 86400) }.should raise_error(ArgumentError) - lambda { @s.rb_time_timespec_new(1447087832, 476451125, -86400) }.should raise_error(ArgumentError) - end + it "returns time object in localtime if offset given equals INT_MAX" do + @s.rb_time_timespec_new(1447087832, 476451125, 0x7fffffff).should == Time.at(1447087832, 476451.125).localtime + t = Time.now + @s.rb_time_timespec_new(t.tv_sec, t.tv_nsec, 0x7fffffff).gmtoff.should == t.gmtoff end - describe "rb_timespec_now" do - it "fills a struct timespec with the current time" do - now = Time.now - time = @s.rb_time_from_timespec(now.utc_offset) - time.should be_an_instance_of(Time) - (time - now).should be_close(0, 10) - end + it "raises an ArgumentError if offset passed is not within range of -86400 and 86400 (exclusive)" do + lambda { @s.rb_time_timespec_new(1447087832, 476451125, 86400) }.should raise_error(ArgumentError) + lambda { @s.rb_time_timespec_new(1447087832, 476451125, -86400) }.should raise_error(ArgumentError) + end + end + + describe "rb_timespec_now" do + it "fills a struct timespec with the current time" do + now = Time.now + time = @s.rb_time_from_timespec(now.utc_offset) + time.should be_an_instance_of(Time) + (time - now).should be_close(0, 10) end end end |