Project

General

Profile

Backport #2376

Updated by jeremyevans0 (Jeremy Evans) about 1 month ago

=begin

The specs pass on MRI 1.9 and on JRuby, but fail on MRI 1.8.7, 1.8.*.

mspec -t /opt/ruby187-dev/bin/ruby core/kernel/__method__spec.rb -fs
ruby 1.8.7 (2009-11-09 patchlevel 202) [i686-linux]

Kernel.__method__
- returns the current method, even when aliased (FAILED - 1)
- returns the original name when aliased method (FAILED - 2)
- returns the caller from blocks too (FAILED - 3)
- returns the caller from define_method too
- returns the caller from block inside define_method too
- returns the caller from a define_method called from the same class
- returns method name even from eval
- returns nil when not called from a method (FAILED - 4)


1)
Kernel.__method__ returns the current method, even when aliased FAILED
Expected :send
to equal :f

/opt/work/mspec.git/lib/mspec/expectations/expectations.rb:15:in `fail_with'
/opt/work/mspec.git/lib/mspec/matchers/base.rb:8:in `=='
/opt/work/rubyspec.git/core/kernel/shared/__method__.rb:9
/opt/work/mspec.git/lib/mspec/runner/mspec.rb:67:in `instance_eval'
/opt/work/mspec.git/lib/mspec/runner/mspec.rb:67:in `protect'
/opt/work/mspec.git/lib/mspec/runner/context.rb:135:in `protect'
/opt/work/rubyspec.git/core/kernel/__method__spec.rb:3:in `all?'
/opt/work/mspec.git/lib/mspec/runner/context.rb:135:in `each'
/opt/work/mspec.git/lib/mspec/runner/context.rb:135:in `all?'
/opt/work/mspec.git/lib/mspec/runner/context.rb:135:in `protect'
/opt/work/mspec.git/lib/mspec/runner/context.rb:163:in `process'
/opt/work/mspec.git/lib/mspec/runner/context.rb:155:in `each'
/opt/work/mspec.git/lib/mspec/runner/context.rb:155:in `process'
/opt/work/mspec.git/lib/mspec/runner/mspec.rb:36:in `describe'
/opt/work/mspec.git/lib/mspec/runner/object.rb:11:in `describe'
/opt/work/rubyspec.git/core/kernel/__method__spec.rb:5
/opt/work/mspec.git/lib/mspec/runner/mspec.rb:55:in `load'
/opt/work/mspec.git/lib/mspec/runner/mspec.rb:55:in `files'
/opt/work/mspec.git/lib/mspec/runner/mspec.rb:67:in `instance_eval'
/opt/work/mspec.git/lib/mspec/runner/mspec.rb:67:in `protect'
/opt/work/mspec.git/lib/mspec/runner/mspec.rb:55:in `files'
/opt/work/mspec.git/lib/mspec/runner/mspec.rb:49:in `each'
/opt/work/mspec.git/lib/mspec/runner/mspec.rb:49:in `files'
/opt/work/mspec.git/lib/mspec/runner/mspec.rb:41:in `process'
/opt/work/mspec.git/lib/mspec/commands/mspec-run.rb:87:in `run'
/opt/work/mspec.git/lib/mspec/utils/script.rb:217:in `main'
/opt/work/mspec.git/bin/mspec-run:8

2)
Kernel.__method__ returns the original name when aliased method FAILED
Expected :send
to equal :f

/opt/work/mspec.git/lib/mspec/expectations/expectations.rb:15:in `fail_with'
/opt/work/mspec.git/lib/mspec/matchers/base.rb:8:in `=='
/opt/work/rubyspec.git/core/kernel/shared/__method__.rb:13
/opt/work/mspec.git/lib/mspec/runner/mspec.rb:67:in `instance_eval'
/opt/work/mspec.git/lib/mspec/runner/mspec.rb:67:in `protect'
/opt/work/mspec.git/lib/mspec/runner/context.rb:135:in `protect'
/opt/work/mspec.git/lib/mspec/expectations/expectations.rb:15:in `all?'
/opt/work/mspec.git/lib/mspec/runner/context.rb:135:in `each'
/opt/work/mspec.git/lib/mspec/runner/context.rb:135:in `all?'
/opt/work/mspec.git/lib/mspec/runner/context.rb:135:in `protect'
/opt/work/mspec.git/lib/mspec/runner/context.rb:163:in `process'
/opt/work/mspec.git/lib/mspec/runner/context.rb:155:in `each'
/opt/work/mspec.git/lib/mspec/runner/context.rb:155:in `process'
/opt/work/mspec.git/lib/mspec/runner/mspec.rb:36:in `describe'
/opt/work/mspec.git/lib/mspec/runner/object.rb:11:in `describe'
/opt/work/rubyspec.git/core/kernel/__method__spec.rb:5
/opt/work/mspec.git/lib/mspec/runner/mspec.rb:55:in `load'
/opt/work/mspec.git/lib/mspec/runner/mspec.rb:55:in `files'
/opt/work/mspec.git/lib/mspec/runner/mspec.rb:67:in `instance_eval'
/opt/work/mspec.git/lib/mspec/runner/mspec.rb:67:in `protect'
/opt/work/mspec.git/lib/mspec/runner/mspec.rb:55:in `files'
/opt/work/mspec.git/lib/mspec/runner/mspec.rb:49:in `each'
/opt/work/mspec.git/lib/mspec/runner/mspec.rb:49:in `files'
/opt/work/mspec.git/lib/mspec/runner/mspec.rb:41:in `process'
/opt/work/mspec.git/lib/mspec/commands/mspec-run.rb:87:in `run'
/opt/work/mspec.git/lib/mspec/utils/script.rb:217:in `main'
/opt/work/mspec.git/bin/mspec-run:8

3)
Kernel.__method__ returns the caller from blocks too FAILED
Expected [:send, :send]
to equal [:h, :h]

/opt/work/mspec.git/lib/mspec/expectations/expectations.rb:15:in `fail_with'
/opt/work/mspec.git/lib/mspec/matchers/base.rb:8:in `=='
/opt/work/rubyspec.git/core/kernel/shared/__method__.rb:20
/opt/work/mspec.git/lib/mspec/runner/mspec.rb:67:in `instance_eval'
/opt/work/mspec.git/lib/mspec/runner/mspec.rb:67:in `protect'
/opt/work/mspec.git/lib/mspec/runner/context.rb:135:in `protect'
/opt/work/mspec.git/lib/mspec/expectations/expectations.rb:15:in `all?'
/opt/work/mspec.git/lib/mspec/runner/context.rb:135:in `each'
/opt/work/mspec.git/lib/mspec/runner/context.rb:135:in `all?'
/opt/work/mspec.git/lib/mspec/runner/context.rb:135:in `protect'
/opt/work/mspec.git/lib/mspec/runner/context.rb:163:in `process'
/opt/work/mspec.git/lib/mspec/runner/context.rb:155:in `each'
/opt/work/mspec.git/lib/mspec/runner/context.rb:155:in `process'
/opt/work/mspec.git/lib/mspec/runner/mspec.rb:36:in `describe'
/opt/work/mspec.git/lib/mspec/runner/object.rb:11:in `describe'
/opt/work/rubyspec.git/core/kernel/__method__spec.rb:5
/opt/work/mspec.git/lib/mspec/runner/mspec.rb:55:in `load'
/opt/work/mspec.git/lib/mspec/runner/mspec.rb:55:in `files'
/opt/work/mspec.git/lib/mspec/runner/mspec.rb:67:in `instance_eval'
/opt/work/mspec.git/lib/mspec/runner/mspec.rb:67:in `protect'
/opt/work/mspec.git/lib/mspec/runner/mspec.rb:55:in `files'
/opt/work/mspec.git/lib/mspec/runner/mspec.rb:49:in `each'
/opt/work/mspec.git/lib/mspec/runner/mspec.rb:49:in `files'
/opt/work/mspec.git/lib/mspec/runner/mspec.rb:41:in `process'
/opt/work/mspec.git/lib/mspec/commands/mspec-run.rb:87:in `run'
/opt/work/mspec.git/lib/mspec/utils/script.rb:217:in `main'
/opt/work/mspec.git/bin/mspec-run:8

4)
Kernel.__method__ returns nil when not called from a method FAILED
Expected :send
to equal nil

/opt/work/mspec.git/lib/mspec/expectations/expectations.rb:15:in `fail_with'
/opt/work/mspec.git/lib/mspec/matchers/base.rb:8:in `=='
/opt/work/rubyspec.git/core/kernel/shared/__method__.rb:49
/opt/work/mspec.git/lib/mspec/runner/mspec.rb:67:in `instance_eval'
/opt/work/mspec.git/lib/mspec/runner/mspec.rb:67:in `protect'
/opt/work/mspec.git/lib/mspec/runner/context.rb:135:in `protect'
/opt/work/rubyspec.git/core/kernel/shared/__method__.rb:43:in `all?'
/opt/work/mspec.git/lib/mspec/runner/context.rb:135:in `each'
/opt/work/mspec.git/lib/mspec/runner/context.rb:135:in `all?'
/opt/work/mspec.git/lib/mspec/runner/context.rb:135:in `protect'
/opt/work/mspec.git/lib/mspec/runner/context.rb:163:in `process'
/opt/work/mspec.git/lib/mspec/runner/context.rb:155:in `each'
/opt/work/mspec.git/lib/mspec/runner/context.rb:155:in `process'
/opt/work/mspec.git/lib/mspec/runner/mspec.rb:36:in `describe'
/opt/work/mspec.git/lib/mspec/runner/object.rb:11:in `describe'
/opt/work/rubyspec.git/core/kernel/__method__spec.rb:5
/opt/work/mspec.git/lib/mspec/runner/mspec.rb:55:in `load'
/opt/work/mspec.git/lib/mspec/runner/mspec.rb:55:in `files'
/opt/work/mspec.git/lib/mspec/runner/mspec.rb:67:in `instance_eval'
/opt/work/mspec.git/lib/mspec/runner/mspec.rb:67:in `protect'
/opt/work/mspec.git/lib/mspec/runner/mspec.rb:55:in `files'
/opt/work/mspec.git/lib/mspec/runner/mspec.rb:49:in `each'
/opt/work/mspec.git/lib/mspec/runner/mspec.rb:49:in `files'
/opt/work/mspec.git/lib/mspec/runner/mspec.rb:41:in `process'
/opt/work/mspec.git/lib/mspec/commands/mspec-run.rb:87:in `run'
/opt/work/mspec.git/lib/mspec/utils/script.rb:217:in `main'
/opt/work/mspec.git/bin/mspec-run:8

Finished in 0.012987 seconds

1 file, 8 examples, 8 expectations, 4 failures, 0 errors

=end

Back