File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212 end
1313
1414 ruby_version_is "4.0" do
15- it "instantiates an object of provided as the first argument set class" do
16- set = nil
17- proc { set = ( 1 ..3 ) . to_set ( EnumerableSpecs ::SetSubclass ) } . should complain ( /Enumerable#to_set/ )
18- set . should be_kind_of ( EnumerableSpecs ::SetSubclass )
19- set . to_a . sort . should == [ 1 , 2 , 3 ]
20- end
21-
2215 it "raises a RangeError if the range is infinite" do
2316 -> { ( 1 ..) . to_set } . should raise_error ( RangeError , "cannot convert endless range to a set" )
2417 -> { ( 1 ...) . to_set } . should raise_error ( RangeError , "cannot convert endless range to a set" )
3326 end
3427 end
3528
29+ ruby_version_is "4.0" ..."4.1" do
30+ it "instantiates an object of provided as the first argument set class and warns" do
31+ set = nil
32+ proc {
33+ set = ( 1 ..3 ) . to_set ( EnumerableSpecs ::SetSubclass )
34+ } . should complain ( /Enumerable#to_set/ )
35+ set . should be_kind_of ( EnumerableSpecs ::SetSubclass )
36+ set . to_a . sort . should == [ 1 , 2 , 3 ]
37+ end
38+ end
39+
40+ ruby_version_is "4.1" do
41+ it "does not accept any positional argument" do
42+ -> {
43+ ( 1 ..3 ) . to_set ( EnumerableSpecs ::SetSubclass )
44+ } . should raise_error ( ArgumentError , 'wrong number of arguments (given 1, expected 0)' )
45+ end
46+ end
47+
3648 it "does not need explicit `require 'set'`" do
3749 output = ruby_exe ( <<~RUBY , options : '--disable-gems' , args : '2>&1' )
3850 puts (1..3).to_set.to_a.inspect
You can’t perform that action at this time.
0 commit comments