summaryrefslogtreecommitdiff
path: root/spec/ruby/core/kernel/fixtures/warn_core_method.rb
blob: fd825624047afad3ba0d9f332f15bc3a9fbe2eee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
raise 'should be run without RubyGems' if defined?(Gem)

public def deprecated(n=1)
  # puts nil, caller(0), nil
  warn "use X instead", uplevel: n
end

1.times do # to test with a non-empty stack above the reported locations
  deprecated
  tap(&:deprecated)
  tap { deprecated(2) }
  # eval sources with a <internal: file are also ignored
  eval "tap(&:deprecated)", nil, "<internal:should-be-skipped-by-warn-uplevel>"
end