mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Test all ISO defined classes direct superclass except Object class.
Move mrbgems ISO direct superclass test to `superclass.rb`. Skips test if class isn't defined. Close #2332.
This commit is contained in:
@@ -5,10 +5,6 @@ assert('Struct', '15.2.18') do
|
||||
Struct.class == Class
|
||||
end
|
||||
|
||||
assert('Struct superclass', '15.2.18.2') do
|
||||
Struct.superclass == Object
|
||||
end
|
||||
|
||||
assert('Struct.new', '15.2.18.3.1') do
|
||||
c = Struct.new(:m1, :m2)
|
||||
c.superclass == Struct and
|
||||
|
||||
@@ -9,10 +9,6 @@ assert('Time', '15.2.19') do
|
||||
Time.class == Class
|
||||
end
|
||||
|
||||
assert('Time superclass', '15.2.19.2') do
|
||||
Time.superclass == Object
|
||||
end
|
||||
|
||||
assert('Time.at', '15.2.19.6.1') do
|
||||
Time.at(1300000000.0)
|
||||
end
|
||||
|
||||
+18
-2
@@ -1,4 +1,5 @@
|
||||
[
|
||||
# [: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'],
|
||||
@@ -12,19 +13,34 @@
|
||||
[: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
|
||||
assert_true Object.const_defined? cls
|
||||
assert_true Object.const_defined? super_cls
|
||||
skip "#{cls} isn't defined" unless Object.const_defined? cls
|
||||
assert_equal Object.const_get(super_cls), Object.const_get(cls).superclass
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user