diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-03-27 22:47:31 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-03-27 22:47:31 +0900 |
| commit | f2c086d7d54930bf1894f262995858f2e9deb999 (patch) | |
| tree | e6953e05d635927fec0c722f0b8598dee354a253 /test/t | |
| parent | 211710d78205b743123563d99a3ab8a94bc787d8 (diff) | |
| parent | 65ace4e02704835dcabff9c9ab67621a8974e7c2 (diff) | |
| download | mruby-f2c086d7d54930bf1894f262995858f2e9deb999.tar.gz mruby-f2c086d7d54930bf1894f262995858f2e9deb999.zip | |
Merge pull request #1963 from ksss/implement-__method__
Implement Kernel#__method__
Diffstat (limited to 'test/t')
| -rw-r--r-- | test/t/kernel.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/t/kernel.rb b/test/t/kernel.rb index c7066fdd9..c8913c718 100644 --- a/test/t/kernel.rb +++ b/test/t/kernel.rb @@ -528,6 +528,20 @@ assert('Kernel#global_variables') do end end +assert('Kernel#__method__') do + assert_equal(:m, Class.new {def m; __method__; end}.new.m) + assert_equal(:m, Class.new {define_method(:m) {__method__}}.new.m) + c = Class.new do + [:m1, :m2].each do |m| + define_method(m) do + __method__ + end + end + end + assert_equal(:m1, c.new.m1) + assert_equal(:m2, c.new.m2) +end + assert('stack extend') do def recurse(count, stop) return count if count > stop @@ -539,3 +553,4 @@ assert('stack extend') do recurse(0, 100000) end end + |
