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

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