Skip to content

Commit 6981814

Browse files
nobueregon
authored andcommitted
Use Integer instead of Fixnum/Bignum
1 parent c953a6f commit 6981814

File tree

144 files changed

+391
-389
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

144 files changed

+391
-389
lines changed

CONTRIBUTING.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Spec are grouped in 5 separate top-level groups:
88

99
* `command_line`: for the ruby executable command-line flags (`-v`, `-e`, etc)
1010
* `language`: for the language keywords and syntax constructs (`if`, `def`, `A::B`, etc)
11-
* `core`: for the core methods (`Fixnum#+`, `String#upcase`, no need to require anything)
11+
* `core`: for the core methods (`Integer#+`, `String#upcase`, no need to require anything)
1212
* `library`: for the standard libraries methods (`CSV.new`, `YAML.parse`, need to require the stdlib)
1313
* `optional/capi`: for functions available to the Ruby C-extension API
1414

@@ -89,7 +89,7 @@ File.should.equal?(File) # Calls #equal? (tests identity)
8989
Numeric.should be_ancestor_of(Float) # Float.ancestors.include?(Numeric)
9090

9191
3.14.should.respond_to?(:to_i)
92-
Fixnum.should have_instance_method(:+)
92+
Integer.should have_instance_method(:+)
9393
Array.should have_method(:new)
9494
```
9595

@@ -124,8 +124,8 @@ If an exception is raised, it will fail the example anyway.
124124

125125
```ruby
126126
-> {
127-
Fixnum
128-
}.should complain(/constant ::Fixnum is deprecated/) # Expect a warning
127+
Integer
128+
}.should complain(/constant ::Integer is deprecated/) # Expect a warning
129129
```
130130

131131
### Guards

command_line/dash_e_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
#needs to test return => LocalJumpError
2525

26-
describe "with -n and a Fixnum range" do
26+
describe "with -n and an Integer range" do
2727
before :each do
2828
@script = "-ne 'print if %s' #{fixture(__FILE__, "conditional_range.txt")}"
2929
end

core/argf/shared/fileno.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# returns first current file even when not yet open
1212
result << @argf.send(@method) while @argf.gets
1313
# returns last current file even when closed
14-
result.map { |d| d.class }.should == [Fixnum, Fixnum, Fixnum, Fixnum]
14+
result.map { |d| d.class }.should == [Integer, Integer, Integer, Integer]
1515
end
1616
end
1717

core/array/bsearch_index_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
@array.bsearch_index { |x| (-1) * (2**100) }.should be_nil
7878
end
7979

80-
it "handles values from Bignum#coerce" do
80+
it "handles values from Integer#coerce" do
8181
[1, 2].should include(@array.bsearch_index { |x| (2**100).coerce((1 - x / 4) * (2**100)).first })
8282
end
8383
end

core/array/first_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
-> { [1, 2].first(-1) }.should raise_error(ArgumentError)
3434
end
3535

36-
it "raises a RangeError when count is a Bignum" do
36+
it "raises a RangeError when count is an Integer" do
3737
-> { [].first(bignum_value) }.should raise_error(RangeError)
3838
end
3939

core/array/fixtures/classes.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def self.compared?
126126
attr_accessor :order
127127
end
128128

129-
class ComparableWithFixnum
129+
class ComparableWithInteger
130130
include Comparable
131131
def initialize(num)
132132
@num = num

core/array/hash_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
[[], [1, 2, 3]].each do |ary|
99
ary.hash.should == ary.dup.hash
10-
ary.hash.should be_an_instance_of(Fixnum)
10+
ary.hash.should be_an_instance_of(Integer)
1111
end
1212
end
1313

core/array/sample_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
obj = mock("array_sample_random")
7070
obj.should_receive(:rand).and_return(0.5)
7171

72-
[1, 2].sample(random: obj).should be_an_instance_of(Fixnum)
72+
[1, 2].sample(random: obj).should be_an_instance_of(Integer)
7373
end
7474

7575
it "raises a NoMethodError if an object passed for the RNG does not define #rand" do
@@ -78,8 +78,8 @@
7878
-> { [1, 2].sample(random: obj) }.should raise_error(NoMethodError)
7979
end
8080

81-
describe "when the object returned by #rand is a Fixnum" do
82-
it "uses the fixnum as index" do
81+
describe "when the object returned by #rand is an Integer" do
82+
it "uses the integer as index" do
8383
random = mock("array_sample_random_ret")
8484
random.should_receive(:rand).and_return(0)
8585

@@ -107,7 +107,7 @@
107107
end
108108
end
109109

110-
describe "when the object returned by #rand is not a Fixnum but responds to #to_int" do
110+
describe "when the object returned by #rand is not an Integer but responds to #to_int" do
111111
it "calls #to_int on the Object" do
112112
value = mock("array_sample_random_value")
113113
value.should_receive(:to_int).and_return(1)

core/array/shared/slice.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ def to.to_int() -2 end
486486
end
487487
end
488488

489-
it "raises a RangeError when the start index is out of range of Fixnum" do
489+
it "raises a RangeError when the start index is out of range of Integer" do
490490
array = [1, 2, 3, 4, 5, 6]
491491
obj = mock('large value')
492492
obj.should_receive(:to_int).and_return(bignum_value)
@@ -502,7 +502,7 @@ def to.to_int() -2 end
502502
array.send(@method, max_long.to_f.prev_float).should == nil
503503
end
504504

505-
it "raises a RangeError when the length is out of range of Fixnum" do
505+
it "raises a RangeError when the length is out of range of Integer" do
506506
array = [1, 2, 3, 4, 5, 6]
507507
obj = mock('large value')
508508
obj.should_receive(:to_int).and_return(bignum_value)

core/array/shared/union.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
[0].send(@method, obj).should == ([0] | [1, 2, 3])
3232
end
3333

34-
# MRI follows hashing semantics here, so doesn't actually call eql?/hash for Fixnum/Symbol
34+
# MRI follows hashing semantics here, so doesn't actually call eql?/hash for Integer/Symbol
3535
it "acts as if using an intermediate hash to collect values" do
3636
not_supported_on :opal do
3737
[5.0, 4.0].send(@method, [5, 4]).should == [5.0, 4.0, 5, 4]

0 commit comments

Comments
 (0)