Skip tests that use `Float` inside; ref
MODIFY
mrbgems/mruby-bin-mruby/bintest/mruby.rb
mrbgems/mruby-bin-mruby/bintest/mruby.rb
@@ -44,13 +44,6 @@ assert 'ARGV value' do
assert_mruby("[]\n", "", true, %w[-e p(ARGV)])
end
-assert('float literal') do
- script, bin = Tempfile.new('test.rb'), Tempfile.new('test.mrb')
- File.write script.path, 'p [3.21, 2e308.infinite?, -2e308.infinite?]'
- system "#{cmd('mrbc')} -g -o #{bin.path} #{script.path}"
- assert_equal "[3.21, 1, -1]", `#{cmd('mruby')} #{bin.path}`.chomp!
-end
-
assert '__END__', '8.6' do
script = Tempfile.new('test.rb')

MODIFY
mrbgems/mruby-enum-ext/test/enum.rb
mrbgems/mruby-enum-ext/test/enum.rb
@@ -100,7 +100,6 @@ end
assert("Enumerable#none?") do
assert_true %w(ant bear cat).none? { |word| word.length == 5 }
assert_false %w(ant bear cat).none? { |word| word.length >= 4 }
- assert_false [1, 3.14, 42].none?(Float)
assert_true [].none?
assert_true [nil, false].none?
assert_false [nil, true].none?
@@ -110,21 +109,21 @@ assert("Enumerable#one?") do
assert_true %w(ant bear cat).one? { |word| word.length == 4 }
assert_false %w(ant bear cat).one? { |word| word.length > 4 }
assert_false %w(ant bear cat).one? { |word| word.length < 4 }
- assert_true [1, 3.14, 42].one?(Float)
assert_false [nil, true, 99].one?
assert_true [nil, true, false].one?
assert_true [ nil, true, 99 ].one?(Integer)
assert_false [].one?
+ assert_true [nil, true, false].one?(NilClass)
end
assert("Enumerable#all? (enhancement)") do
- assert_false [1, 2, 3.14].all?(Integer)
- assert_true [1, 2, 3.14].all?(Numeric)
+ assert_false [1, 2, nil].all?(Integer)
+ assert_true [1, 2, 3].all?(Numeric)
end
assert("Enumerable#any? (enhancement)") do
- assert_false [1, 2, 3].all?(Float)
assert_true [nil, true, 99].any?(Integer)
+ assert_false [1, 2, 3].any?(Array)
end
assert("Enumerable#each_with_object") do

MODIFY
mrbgems/mruby-enum-lazy/test/lazy.rb
mrbgems/mruby-enum-lazy/test/lazy.rb
@@ -41,7 +41,7 @@ assert("Enumerator::Lazy laziness") do
end
assert("Enumerator::Lazy#to_enum") do
- lazy_enum = (0..Float::INFINITY).lazy.to_enum(:each_slice, 2)
+ lazy_enum = (0..).lazy.to_enum(:each_slice, 2)
assert_kind_of Enumerator::Lazy, lazy_enum
assert_equal [0*1, 2*3, 4*5, 6*7], lazy_enum.map { |a| a.first * a.last }.first(4)
end

MODIFY
mrbgems/mruby-enumerator/test/enumerator.rb
mrbgems/mruby-enumerator/test/enumerator.rb
@@ -552,10 +552,10 @@ assert 'Range#each' do
end
assert 'Enumerable#zip' do
- assert_equal [[1, 10], [2, 11], [3, 12]], [1,2,3].zip(10..Float::INFINITY)
+ assert_equal [[1, 10], [2, 11], [3, 12]], [1,2,3].zip(10..)
ret = []
- assert_equal nil, [1,2,3].zip(10..Float::INFINITY) { |i| ret << i }
+ assert_equal nil, [1,2,3].zip(10..) { |i| ret << i }
assert_equal [[1, 10], [2, 11], [3, 12]], ret
assert_raise(TypeError) { [1].zip(1) }

MODIFY
mrbgems/mruby-method/test/method.rb
mrbgems/mruby-method/test/method.rb
@@ -406,8 +406,9 @@ end
assert 'UnboundMethod#==' do
assert_false(Integer.instance_method(:+) == Integer.instance_method(:-))
assert_true(Integer.instance_method(:+) == Integer.instance_method(:+))
- assert_false(Integer.instance_method(:+) == Float.instance_method(:+))
assert_true(UnboundMethod.instance_method(:==) == UnboundMethod.instance_method(:eql?))
+ skip unless Object.const_defined?(:Float)
+ assert_false(Integer.instance_method(:+) == Float.instance_method(:+))
end
assert 'UnboundMethod#super_method' do

MODIFY
mrbgems/mruby-pack/test/pack.rb
mrbgems/mruby-pack/test/pack.rb
+# coding: utf-8
PACK_IS_LITTLE_ENDIAN = "\x01\00".unpack('S')[0] == 0x01
def assert_pack tmpl, packed, unpacked
@@ -91,6 +92,7 @@ assert('issue #1') do
end
assert 'pack float' do
+ skip unless Object.const_defined?(:Float)
assert_pack 'e', "\x00\x00@@", [3.0]
assert_pack 'g', "@@\x00\x00", [3.0]
@@ -104,6 +106,7 @@ assert 'pack float' do
end
assert 'pack double' do
+ skip unless Object.const_defined?(:Float)
assert_pack 'E', "\x00\x00\x00\x00\x00\x00\b@", [3.0]
assert_pack 'G', "@\b\x00\x00\x00\x00\x00\x00", [3.0]

MODIFY
mrbgems/mruby-random/test/random.rb
mrbgems/mruby-random/test/random.rb
@@ -34,6 +34,7 @@ end
assert("return class of Kernel.rand") do
assert_kind_of(Integer, rand(3))
assert_kind_of(Integer, rand(1.5))
+ skip unless Object.const_defined?(:Float)
assert_kind_of(Float, rand)
assert_kind_of(Float, rand(0.5))
end

MODIFY
mrbgems/mruby-time/test/time.rb
mrbgems/mruby-time/test/time.rb
@@ -12,6 +12,7 @@ end
assert('Time.at', '15.2.19.6.1') do
assert_kind_of(Time, Time.at(1300000000.0))
+ skip unless Object.const_defined?(:Float)
assert_raise(FloatDomainError) { Time.at(Float::NAN) }
assert_raise(FloatDomainError) { Time.at(Float::INFINITY) }
assert_raise(FloatDomainError) { Time.at(-Float::INFINITY) }
@@ -69,31 +70,33 @@ assert('Time.utc', '15.2.19.6.6') do
end
assert('Time#+', '15.2.19.7.1') do
- t1 = Time.at(1300000000.0)
+ t1 = Time.at(1300000000)
t2 = t1.+(60)
assert_equal("Sun Mar 13 07:07:40 2011", t2.utc.asctime)
+ skip unless Object.const_defined?(:Float)
assert_raise(FloatDomainError) { Time.at(0) + Float::NAN }
assert_raise(FloatDomainError) { Time.at(0) + Float::INFINITY }
assert_raise(FloatDomainError) { Time.at(0) + -Float::INFINITY }
end
assert('Time#-', '15.2.19.7.2') do
- t1 = Time.at(1300000000.0)
+ t1 = Time.at(1300000000)
t2 = t1.-(60)
assert_equal("Sun Mar 13 07:05:40 2011", t2.utc.asctime)
+ skip unless Object.const_defined?(:Float)
assert_raise(FloatDomainError) { Time.at(0) - Float::NAN }
assert_raise(FloatDomainError) { Time.at(0) - Float::INFINITY }
assert_raise(FloatDomainError) { Time.at(0) - -Float::INFINITY }
end
assert('Time#<=>', '15.2.19.7.3') do
- t1 = Time.at(1300000000.0)
- t2 = Time.at(1400000000.0)
- t3 = Time.at(1500000000.0)
+ t1 = Time.at(1300000000)
+ t2 = Time.at(1400000000)
+ t3 = Time.at(1500000000)
assert_equal(1, t2 <=> t1)
assert_equal(0, t2 <=> t2)
@@ -118,7 +121,7 @@ assert('Time#dst?', '15.2.19.7.7') do
end
assert('Time#getgm', '15.2.19.7.8') do
- assert_equal("Sun Mar 13 07:06:40 2011", Time.at(1300000000.0).getgm.asctime)
+ assert_equal("Sun Mar 13 07:06:40 2011", Time.at(1300000000).getgm.asctime)
end
assert('Time#getlocal', '15.2.19.7.9') do
@@ -131,11 +134,11 @@ assert('Time#getlocal', '15.2.19.7.9') do
end
assert('Time#getutc', '15.2.19.7.10') do
- assert_equal("Sun Mar 13 07:06:40 2011", Time.at(1300000000.0).getutc.asctime)
+ assert_equal("Sun Mar 13 07:06:40 2011", Time.at(1300000000).getutc.asctime)
end
assert('Time#gmt?', '15.2.19.7.11') do
- assert_predicate(Time.at(1300000000.0).utc, :gmt?)
+ assert_predicate(Time.at(1300000000).utc, :gmt?)
end
# ATM not implemented
@@ -192,14 +195,17 @@ assert('Times#sec', '15.2.19.7.23') do
end
assert('Time#to_f', '15.2.19.7.24') do
+ skip unless Object.const_defined?(:Float)
assert_operator(2.0, :eql?, Time.at(2).to_f)
end
assert('Time#to_i', '15.2.19.7.25') do
- assert_operator(2, :eql?, Time.at(2.0).to_i)
+ assert_operator(2, :eql?, Time.at(2).to_i)
end
assert('Time#usec', '15.2.19.7.26') do
+ assert_equal(0, Time.at(1300000000).usec)
+ skip unless Object.const_defined?(:Float)
assert_equal(0, Time.at(1300000000.0).usec)
end
@@ -210,7 +216,7 @@ assert('Time#utc', '15.2.19.7.27') do
end
assert('Time#utc?', '15.2.19.7.28') do
- assert_predicate(Time.at(1300000000.0).utc, :utc?)
+ assert_predicate(Time.at(1300000000).utc, :utc?)
end
# ATM not implemented
@@ -229,7 +235,7 @@ assert('Time#year', '15.2.19.7.32') do
end
assert('Time#zone', '15.2.19.7.33') do
- assert_equal('UTC', Time.at(1300000000.0).utc.zone)
+ assert_equal('UTC', Time.at(1300000000).utc.zone)
end
# Not ISO specified

MODIFY
mrblib/numeric.rb
mrblib/numeric.rb
@@ -130,7 +130,7 @@ class Integer
# Returns the receiver simply.
#
# ISO 15.2.8.3.14
- def ceil
+ def ceil(n=0)
self
end
@@ -138,7 +138,7 @@ class Integer
# Returns the receiver simply.
#
# ISO 15.2.8.3.17
- def floor
+ def floor(n=0)
self
end

MODIFY
test/t/integer.rb
test/t/integer.rb
@@ -37,40 +37,42 @@ end
assert('Integer#/', '15.2.8.3.4') do
a = 2/1
- b = 2/1.0
-
assert_equal 2, a
+ a = 5/2
+ assert_equal 2, a
+ skip unless Object.const_defined?(:Float)
+ b = 2/1.0
assert_equal 2.0, b
end
assert('Integer#quo') do
a = 6.quo(5)
-
assert_equal 1.2, a
-end
+end if Object.const_defined?(:Float)
assert('Integer#%', '15.2.8.3.5') do
a = 1%1
- b = 1%1.0
- c = 2%4
- d = 2%5
- e = 2%-5
- f = -2%5
- g = -2%-5
- h = 2%-2
- i = -2%2
- j = -2%-2
+ b = 2%4
+ c = 2%5
+ d = 2%-5
+ e = -2%5
+ f = -2%-5
+ g = 2%-2
+ h = -2%2
+ i = -2%-2
assert_equal 0, a
- assert_equal 0.0, b
+ assert_equal 2, b
assert_equal 2, c
- assert_equal 2, d
- assert_equal(-3, e)
- assert_equal 3, f
- assert_equal(-2, g)
+ assert_equal(-3, d)
+ assert_equal 3, e
+ assert_equal(-2, f)
+ assert_equal 0, g
assert_equal 0, h
assert_equal 0, i
- assert_equal 0, j
+ skip unless Object.const_defined?(:Float)
+ j = 1%1.0
+ assert_equal 0.0, j
end
assert('Integer#<=>', '15.2.9.3.6') do

Skip tests that use `Float` inside; ref #5421