Skip to content

Commit

Permalink
Use a simpler limits for spec'ing too big array sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
eregon committed Oct 4, 2016
1 parent 5c78608 commit 66f6ccc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 44 deletions.
20 changes: 0 additions & 20 deletions core/array/fixtures/classes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,6 @@ module ArraySpecs
SampleRange = 0..1000
SampleCount = 1000

not_compliant_on :rubinius do
def self.max_32bit_size
2**32/4
end

def self.max_64bit_size
2**64/8
end
end

deviates_on :rubinius do
def self.max_32bit_size
2**30-1
end

def self.max_64bit_size
2**62-1
end
end

def self.frozen_array
frozen_array = [1,2,3]
frozen_array.freeze
Expand Down
14 changes: 2 additions & 12 deletions core/array/initialize_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,18 +107,8 @@
lambda { [].send(:initialize, -1) }.should raise_error(ArgumentError)
end

platform_is wordsize: 32 do
it "raises an ArgumentError if size is too large" do
max_size = ArraySpecs.max_32bit_size
lambda { [].send(:initialize, max_size + 1) }.should raise_error(ArgumentError)
end
end

platform_is wordsize: 64 do
it "raises an ArgumentError if size is too large" do
max_size = ArraySpecs.max_64bit_size
lambda { [].send(:initialize, max_size + 1) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if size is too large" do
lambda { [].send(:initialize, fixnum_max+1) }.should raise_error(ArgumentError)
end

it "calls #to_int to convert the size argument to an Integer when object is given" do
Expand Down
14 changes: 2 additions & 12 deletions core/array/new_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,8 @@
lambda { Array.new(-1) }.should raise_error(ArgumentError)
end

platform_is wordsize: 32 do
it "raises an ArgumentError if size is too large" do
max_size = ArraySpecs.max_32bit_size
lambda { Array.new(max_size + 1) }.should raise_error(ArgumentError)
end
end

platform_is wordsize: 64 do
it "raises an ArgumentError if size is too large" do
max_size = ArraySpecs.max_64bit_size
lambda { Array.new(max_size + 1) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError if size is too large" do
lambda { Array.new(fixnum_max+1) }.should raise_error(ArgumentError)
end

it "calls #to_int to convert the size argument to an Integer when object is given" do
Expand Down

0 comments on commit 66f6ccc

Please sign in to comment.