Commit d9985631 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto

Merge pull request #2396 from take-cheeze/superclass_check

Move direct superclass checking to `test/t/superclass.rb`.
parents 44a834f3 77047b5e
...@@ -5,10 +5,6 @@ assert('Struct', '15.2.18') do ...@@ -5,10 +5,6 @@ assert('Struct', '15.2.18') do
Struct.class == Class Struct.class == Class
end end
assert('Struct superclass', '15.2.18.2') do
Struct.superclass == Object
end
assert('Struct.new', '15.2.18.3.1') do assert('Struct.new', '15.2.18.3.1') do
c = Struct.new(:m1, :m2) c = Struct.new(:m1, :m2)
c.superclass == Struct and c.superclass == Struct and
......
...@@ -9,10 +9,6 @@ assert('Time', '15.2.19') do ...@@ -9,10 +9,6 @@ assert('Time', '15.2.19') do
Time.class == Class Time.class == Class
end end
assert('Time superclass', '15.2.19.2') do
Time.superclass == Object
end
assert('Time.at', '15.2.19.6.1') do assert('Time.at', '15.2.19.6.1') do
Time.at(1300000000.0) Time.at(1300000000.0)
end end
......
...@@ -14,8 +14,3 @@ assert('ArgumentError', '15.2.24') do ...@@ -14,8 +14,3 @@ assert('ArgumentError', '15.2.24') do
assert_equal(Class, ArgumentError.class) assert_equal(Class, ArgumentError.class)
assert_equal(ArgumentError, e2.class) assert_equal(ArgumentError, e2.class)
end end
assert('ArgumentError superclass', '15.2.24.2') do
assert_equal(StandardError, ArgumentError.superclass)
end
...@@ -5,10 +5,6 @@ assert('Array', '15.2.12') do ...@@ -5,10 +5,6 @@ assert('Array', '15.2.12') do
assert_equal(Class, Array.class) assert_equal(Class, Array.class)
end end
assert('Array superclass', '15.2.12.2') do
assert_equal(Object, Array.superclass)
end
assert('Array inclueded modules', '15.2.12.3') do assert('Array inclueded modules', '15.2.12.3') do
assert_true(Array.include?(Enumerable)) assert_true(Array.include?(Enumerable))
end end
......
...@@ -5,10 +5,6 @@ assert('Class', '15.2.3') do ...@@ -5,10 +5,6 @@ assert('Class', '15.2.3') do
assert_equal(Class, Class.class) assert_equal(Class, Class.class)
end end
assert('Class superclass', '15.2.3.2') do
assert_equal(Module, Class.superclass)
end
assert('Class#initialize', '15.2.3.3.1') do assert('Class#initialize', '15.2.3.3.1') do
c = Class.new do c = Class.new do
def test def test
......
...@@ -5,10 +5,6 @@ assert('Exception', '15.2.22') do ...@@ -5,10 +5,6 @@ assert('Exception', '15.2.22') do
assert_equal Class, Exception.class assert_equal Class, Exception.class
end end
assert('Exception superclass', '15.2.22.2') do
assert_equal Object, Exception.superclass
end
assert('Exception.exception', '15.2.22.4.1') do assert('Exception.exception', '15.2.22.4.1') do
e = Exception.exception('a') e = Exception.exception('a')
......
...@@ -11,10 +11,6 @@ assert('FalseClass false', '15.2.6.1') do ...@@ -11,10 +11,6 @@ assert('FalseClass false', '15.2.6.1') do
assert_false FalseClass.method_defined? :new assert_false FalseClass.method_defined? :new
end end
assert('FalseClass superclass', '15.2.6.2') do
assert_equal Object, FalseClass.superclass
end
assert('FalseClass#&', '15.2.6.3.1') do assert('FalseClass#&', '15.2.6.3.1') do
assert_false false.&(true) assert_false false.&(true)
assert_false false.&(false) assert_false false.&(false)
......
...@@ -5,10 +5,6 @@ assert('Float', '15.2.9') do ...@@ -5,10 +5,6 @@ assert('Float', '15.2.9') do
assert_equal Class, Float.class assert_equal Class, Float.class
end end
assert('Float superclass', '15.2.9.2') do
assert_equal Numeric, Float.superclass
end
assert('Float#+', '15.2.9.3.1') do assert('Float#+', '15.2.9.3.1') do
a = 3.123456788 + 0.000000001 a = 3.123456788 + 0.000000001
b = 3.123456789 + 1 b = 3.123456789 + 1
......
...@@ -5,10 +5,6 @@ assert('Hash', '15.2.13') do ...@@ -5,10 +5,6 @@ assert('Hash', '15.2.13') do
assert_equal Class, Hash.class assert_equal Class, Hash.class
end end
assert('Hash superclass', '15.2.13.2') do
assert_equal Object, Hash.superclass
end
assert('Hash#==', '15.2.13.4.1') do assert('Hash#==', '15.2.13.4.1') do
assert_true({ 'abc' => 'abc' } == { 'abc' => 'abc' }) assert_true({ 'abc' => 'abc' } == { 'abc' => 'abc' })
assert_false({ 'abc' => 'abc' } == { 'cba' => 'cba' }) assert_false({ 'abc' => 'abc' } == { 'cba' => 'cba' })
......
...@@ -4,7 +4,3 @@ ...@@ -4,7 +4,3 @@
assert('IndexError', '15.2.33') do assert('IndexError', '15.2.33') do
assert_equal Class, IndexError.class assert_equal Class, IndexError.class
end end
assert('IndexError superclass', '15.2.33.2') do
assert_equal StandardError, IndexError.superclass
end
...@@ -5,10 +5,6 @@ assert('Integer', '15.2.8') do ...@@ -5,10 +5,6 @@ assert('Integer', '15.2.8') do
assert_equal Class, Integer.class assert_equal Class, Integer.class
end end
assert('Integer superclass', '15.2.8.2') do
assert_equal Numeric, Integer.superclass
end
assert('Integer#+', '15.2.8.3.1') do assert('Integer#+', '15.2.8.3.1') do
a = 1+1 a = 1+1
b = 1+1.0 b = 1+1.0
......
...@@ -5,10 +5,6 @@ assert('Module', '15.2.2') do ...@@ -5,10 +5,6 @@ assert('Module', '15.2.2') do
assert_equal Class, Module.class assert_equal Class, Module.class
end end
assert('Module superclass', '15.2.2.2') do
assert_equal Object, Module.superclass
end
# TODO not implemented ATM assert('Module.constants', '15.2.2.3.1') do # TODO not implemented ATM assert('Module.constants', '15.2.2.3.1') do
# TODO not implemented ATM assert('Module.nesting', '15.2.2.3.2') do # TODO not implemented ATM assert('Module.nesting', '15.2.2.3.2') do
......
...@@ -5,10 +5,6 @@ assert('NameError', '15.2.31') do ...@@ -5,10 +5,6 @@ assert('NameError', '15.2.31') do
assert_equal Class, NameError.class assert_equal Class, NameError.class
end end
assert('NameError superclass', '15.2.31.2') do
assert_equal StandardError, NameError.superclass
end
assert('NameError#name', '15.2.31.2.1') do assert('NameError#name', '15.2.31.2.1') do
# This check is not duplicate with 15.2.31.2.2 check. # This check is not duplicate with 15.2.31.2.2 check.
......
...@@ -10,10 +10,6 @@ assert('NilClass', '15.2.4.1') do ...@@ -10,10 +10,6 @@ assert('NilClass', '15.2.4.1') do
assert_false NilClass.method_defined? :new assert_false NilClass.method_defined? :new
end end
assert('NilClass superclass', '15.2.4.2') do
assert_equal Object, NilClass.superclass
end
assert('NilClass#&', '15.2.4.3.1') do assert('NilClass#&', '15.2.4.3.1') do
assert_false nil.&(true) assert_false nil.&(true)
assert_false nil.&(nil) assert_false nil.&(nil)
......
...@@ -8,10 +8,6 @@ assert('NoMethodError', '15.2.32') do ...@@ -8,10 +8,6 @@ assert('NoMethodError', '15.2.32') do
end end
end end
assert('NoMethodError superclass', '15.2.32.2') do
assert_equal NameError, NoMethodError.superclass
end
assert('NoMethodError#args', '15.2.32.2.1') do assert('NoMethodError#args', '15.2.32.2.1') do
a = NoMethodError.new 'test', :test, [1, 2] a = NoMethodError.new 'test', :test, [1, 2]
assert_equal [1, 2], a.args assert_equal [1, 2], a.args
......
...@@ -5,10 +5,6 @@ assert('Numeric', '15.2.7') do ...@@ -5,10 +5,6 @@ assert('Numeric', '15.2.7') do
assert_equal Class, Numeric.class assert_equal Class, Numeric.class
end end
assert('Numeric superclass', '15.2.7.2') do
assert_equal Object, Numeric.superclass
end
assert('Numeric#+@', '15.2.7.4.1') do assert('Numeric#+@', '15.2.7.4.1') do
assert_equal(+1, +1) assert_equal(+1, +1)
end end
......
...@@ -5,10 +5,6 @@ assert('Proc', '15.2.17') do ...@@ -5,10 +5,6 @@ assert('Proc', '15.2.17') do
assert_equal Class, Proc.class assert_equal Class, Proc.class
end end
assert('Proc superclass', '15.2.17.2') do
assert_equal Object, Proc.superclass
end
assert('Proc.new', '15.2.17.3.1') do assert('Proc.new', '15.2.17.3.1') do
assert_raise ArgumentError do assert_raise ArgumentError do
Proc.new Proc.new
......
...@@ -5,10 +5,6 @@ assert('Range', '15.2.14') do ...@@ -5,10 +5,6 @@ assert('Range', '15.2.14') do
assert_equal Class, Range.class assert_equal Class, Range.class
end end
assert('Range superclass', '15.2.14.2') do
assert_equal Object, Range.superclass
end
assert('Range#==', '15.2.14.4.1') do assert('Range#==', '15.2.14.4.1') do
assert_true (1..10) == (1..10) assert_true (1..10) == (1..10)
assert_false (1..10) == (1..100) assert_false (1..10) == (1..100)
......
...@@ -4,7 +4,3 @@ ...@@ -4,7 +4,3 @@
assert('RangeError', '15.2.26') do assert('RangeError', '15.2.26') do
assert_equal Class, RangeError.class assert_equal Class, RangeError.class
end end
assert('RangeError superclass', '15.2.26.2') do
assert_equal StandardError, RangeError.superclass
end
...@@ -4,7 +4,3 @@ ...@@ -4,7 +4,3 @@
assert('StandardError', '15.2.23') do assert('StandardError', '15.2.23') do
assert_equal Class, StandardError.class assert_equal Class, StandardError.class
end end
assert('StandardError superclass', '15.2.23.2') do
assert_equal Exception, StandardError.superclass
end
...@@ -5,10 +5,6 @@ assert('String', '15.2.10') do ...@@ -5,10 +5,6 @@ assert('String', '15.2.10') do
assert_equal Class, String.class assert_equal Class, String.class
end end
assert('String superclass', '15.2.10.2') do
assert_equal Object, String.superclass
end
assert('String#<=>', '15.2.10.5.1') do assert('String#<=>', '15.2.10.5.1') do
a = '' <=> '' a = '' <=> ''
b = '' <=> 'not empty' b = '' <=> 'not empty'
......
[
# [:Object, :implementation_defined_value, '15.2.2.1'],
[:Module, :Object, '15.2.2.2'],
[:Class, :Module, '15.2.3.2'],
[:NilClass, :Object, '15.2.4.2'],
[:TrueClass, :Object, '15.2.5.2'],
[:FalseClass, :Object, '15.2.6.2'],
[:Numeric, :Object, '15.2.7.2'],
[:Integer, :Numeric, '15.2.8.2'],
[:Float, :Numeric, '15.2.9.2'],
[:String, :Object, '15.2.10.2'],
[:Symbol, :Object, '15.2.11.2'],
[:Array, :Object, '15.2.12.2'],
[:Hash, :Object, '15.2.13.2'],
[:Range, :Object, '15.2.14.2'],
[:Regexp, :Object, '15.2.15.2'],
[:MatchData, :Object, '15.2.16.2'],
[:Proc, :Object, '15.2.17.2'],
[:Struct, :Object, '15.2.18.2'],
[:Time, :Object, '15.2.19.2'],
[:IO, :Object, '15.2.20.2'],
[:File, :IO, '15.2.21.2'],
[:Exception, :Object, '15.2.22.2'],
[:StandardError, :Exception, '15.2.23.2'],
[:ArgumentError, :StandardError, '15.2.24.2'],
[:LocalJumpError, :StandardError, '15.2.25.2'],
[:RangeError, :StandardError, '12.2.26.2'],
[:RegexpError, :StandardError, '12.2.27.2'],
[:RuntimeError, :StandardError, '12.2.28.2'],
[:TypeError, :StandardError, '12.2.29.2'],
[:ZeroDivisionError, :StandardError, '12.2.30.2'],
[:NameError, :StandardError, '15.2.31.2'],
[:NoMethodError, :NameError, '15.2.32.2'],
[:IndexError, :StandardError, '15.2.33.2'],
[:IOError, :StandardError, '12.2.34.2'],
[:EOFError, :IOError, '12.2.35.2'],
[:SystemCallError, :StandardError, '15.2.36.2'],
[:ScriptError, :Exception, '12.2.37.2'],
[:SyntaxError, :ScriptError, '12.2.38.2'],
[:LoadError, :ScriptError, '12.2.39,2'],
].each do |cls, super_cls, iso|
assert "Direct superclass of #{cls}", iso do
skip "#{cls} isn't defined" unless Object.const_defined? cls
assert_equal Object.const_get(super_cls), Object.const_get(cls).superclass
end
end
...@@ -5,10 +5,6 @@ assert('Symbol', '15.2.11') do ...@@ -5,10 +5,6 @@ assert('Symbol', '15.2.11') do
assert_equal Class, Symbol.class assert_equal Class, Symbol.class
end end
assert('Symbol superclass', '15.2.11.2') do
assert_equal Object, Symbol.superclass
end
assert('Symbol#===', '15.2.11.3.1') do assert('Symbol#===', '15.2.11.3.1') do
assert_true :abc == :abc assert_true :abc == :abc
assert_false :abc == :cba assert_false :abc == :cba
......
...@@ -11,10 +11,6 @@ assert('TrueClass true', '15.2.5.1') do ...@@ -11,10 +11,6 @@ assert('TrueClass true', '15.2.5.1') do
assert_false TrueClass.method_defined? :new assert_false TrueClass.method_defined? :new
end end
assert('TrueClass superclass', '15.2.5.2') do
assert_equal Object, TrueClass.superclass
end
assert('TrueClass#&', '15.2.5.3.1') do assert('TrueClass#&', '15.2.5.3.1') do
assert_true true.&(true) assert_true true.&(true)
assert_false true.&(false) assert_false true.&(false)
......
...@@ -4,8 +4,3 @@ ...@@ -4,8 +4,3 @@
assert('TypeError', '15.2.29') do assert('TypeError', '15.2.29') do
assert_equal Class, TypeError.class assert_equal Class, TypeError.class
end end
assert('TypeError superclass', '15.2.29.2') do
assert_equal StandardError, TypeError.superclass
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment