summaryrefslogtreecommitdiff
path: root/test/ruby/endblockwarn.rb
blob: 8da5c241eeb6c5035ad1339d1f5f360629400e60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
BEGIN {
  if errout = ARGV.shift
    dir = File.dirname(File.expand_path(__FILE__))
    basename = File.basename(__FILE__)
    require "#{dir}/envutil"
    STDERR.reopen(File.open(errout, "w"))
    STDERR.sync = true
    Dir.chdir(dir)
    cmd = "\"#{EnvUtil.rubybin}\" \"#{basename}\""
    exec(cmd)
    exit!("must not reach here")
  end
}

def end1
  END {}
end

end1

eval <<EOE
  def end2
    END {}
  end
EOE