diff options
| author | Blaž Hrastnik <[email protected]> | 2015-07-09 23:46:54 +0200 |
|---|---|---|
| committer | Blaž Hrastnik <[email protected]> | 2015-07-13 14:04:42 +0200 |
| commit | f962890a928b566c0f5ca7fdff5ef4ce19207e65 (patch) | |
| tree | 232b194c8635db7561dc7a6d818026077e87eb90 /test/t/module.rb | |
| parent | d0e67aada795620c2bce49db8c73e87718753614 (diff) | |
| download | mruby-f962890a928b566c0f5ca7fdff5ef4ce19207e65.tar.gz mruby-f962890a928b566c0f5ca7fdff5ef4ce19207e65.zip | |
Implement Module#prepend.
Diffstat (limited to 'test/t/module.rb')
| -rw-r--r-- | test/t/module.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/t/module.rb b/test/t/module.rb index ecb969475..9faaf6e2c 100644 --- a/test/t/module.rb +++ b/test/t/module.rb @@ -474,6 +474,39 @@ end # Not ISO specified +assert('Module#prepend') do + module M0 + def m1; [:M0] end + end + module M1 + def m1; [:M1, super, :M1] end + end + module M2 + def m1; [:M2, super, :M2] end + end + M3 = Module.new do + def m1; [:M3, super, :M3] end + end + module M4 + def m1; [:M4, super, :M4] end + end + + class C0 + include M0 + prepend M1 + def m1; [:C0, super, :C0] end + end + class C1 < C0 + prepend M2, M3 + include M4 + def m1; [:C1, super, :C1] end + end + + obj = C1.new + expected = [:M2,[:M3,[:C1,[:M4,[:M1,[:C0,[:M0],:C0],:M1],:M4],:C1],:M3],:M2] + assert_equal(expected, obj.m1) +end + assert('Module#to_s') do module Test4to_sModules end |
