mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
suppress warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1d3c2678e2
commit
bf4a6a0557
2 changed files with 26 additions and 10 deletions
|
@ -37,7 +37,7 @@ class TestSystem < Test::Unit::TestCase
|
||||||
tmp = open(tmpfilename, "w")
|
tmp = open(tmpfilename, "w")
|
||||||
tmp.print "this is a leading junk\n";
|
tmp.print "this is a leading junk\n";
|
||||||
tmp.print "#! /usr/local/bin/ruby -s\n";
|
tmp.print "#! /usr/local/bin/ruby -s\n";
|
||||||
tmp.print "print $zzz\n";
|
tmp.print "print $zzz if defined? $zzz\n";
|
||||||
tmp.print "__END__\n";
|
tmp.print "__END__\n";
|
||||||
tmp.print "this is a trailing junk\n";
|
tmp.print "this is a trailing junk\n";
|
||||||
tmp.close
|
tmp.close
|
||||||
|
@ -49,7 +49,7 @@ class TestSystem < Test::Unit::TestCase
|
||||||
tmp.print "#! /non/exist\\interpreter?/./to|be:ignored\n";
|
tmp.print "#! /non/exist\\interpreter?/./to|be:ignored\n";
|
||||||
tmp.print "this is a leading junk\n";
|
tmp.print "this is a leading junk\n";
|
||||||
tmp.print "#! /usr/local/bin/ruby -s\n";
|
tmp.print "#! /usr/local/bin/ruby -s\n";
|
||||||
tmp.print "print $zzz\n";
|
tmp.print "print $zzz if defined? $zzz\n";
|
||||||
tmp.print "__END__\n";
|
tmp.print "__END__\n";
|
||||||
tmp.print "this is a trailing junk\n";
|
tmp.print "this is a trailing junk\n";
|
||||||
tmp.close
|
tmp.close
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
require 'test/unit'
|
require 'test/unit'
|
||||||
|
require 'stringio'
|
||||||
|
|
||||||
class TestRubyYield < Test::Unit::TestCase
|
class TestRubyYield < Test::Unit::TestCase
|
||||||
|
|
||||||
|
@ -209,8 +210,8 @@ class TestRubyYieldGen < Test::Unit::TestCase
|
||||||
if args.last == []
|
if args.last == []
|
||||||
args = args[0...-1]
|
args = args[0...-1]
|
||||||
end
|
end
|
||||||
code = "emu_return_args #{args.map {|a| a.join('') }.join(",")}"
|
code = "emu_return_args(#{args.map {|a| a.join('') }.join(",")})"
|
||||||
eval code
|
eval code, nil, 'generated_code_in_emu_eval_args'
|
||||||
end
|
end
|
||||||
|
|
||||||
def emu_bind_single(arg, param, result_binding)
|
def emu_bind_single(arg, param, result_binding)
|
||||||
|
@ -324,6 +325,16 @@ class TestRubyYieldGen < Test::Unit::TestCase
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def disable_stderr
|
||||||
|
begin
|
||||||
|
save_stderr = $stderr
|
||||||
|
$stderr = StringIO.new
|
||||||
|
yield
|
||||||
|
ensure
|
||||||
|
$stderr = save_stderr
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def check_nofork(t, islambda=false)
|
def check_nofork(t, islambda=false)
|
||||||
t, vars = rename_var(t)
|
t, vars = rename_var(t)
|
||||||
t = t.subst('vars') { " [#{vars.join(",")}]" }
|
t = t.subst('vars') { " [#{vars.join(",")}]" }
|
||||||
|
@ -331,11 +342,13 @@ class TestRubyYieldGen < Test::Unit::TestCase
|
||||||
s = t.to_s
|
s = t.to_s
|
||||||
#print "#{s}\t\t"
|
#print "#{s}\t\t"
|
||||||
#STDOUT.flush
|
#STDOUT.flush
|
||||||
|
eval_values = disable_stderr {
|
||||||
begin
|
begin
|
||||||
eval_values = eval(s)
|
eval(s, nil, 'generated_code_in_check_nofork')
|
||||||
rescue ArgumentError
|
rescue ArgumentError
|
||||||
eval_values = ArgumentError
|
ArgumentError
|
||||||
end
|
end
|
||||||
|
}
|
||||||
#success = emu_values == eval_values ? 'succ' : 'fail'
|
#success = emu_values == eval_values ? 'succ' : 'fail'
|
||||||
#puts "eval:#{vs_ev.inspect[1...-1].delete(' ')}\temu:#{vs_emu.inspect[1...-1].delete(' ')}\t#{success}"
|
#puts "eval:#{vs_ev.inspect[1...-1].delete(' ')}\temu:#{vs_emu.inspect[1...-1].delete(' ')}\t#{success}"
|
||||||
assert_equal(emu_values, eval_values, s)
|
assert_equal(emu_values, eval_values, s)
|
||||||
|
@ -358,7 +371,10 @@ class TestRubyYieldGen < Test::Unit::TestCase
|
||||||
def test_yield_enum
|
def test_yield_enum
|
||||||
syntax = Sentence.expand_syntax(Syntax)
|
syntax = Sentence.expand_syntax(Syntax)
|
||||||
Sentence.each(syntax, :test_enum, 4) {|t|
|
Sentence.each(syntax, :test_enum, 4) {|t|
|
||||||
r1, r2 = eval(t.to_s)
|
code = t.to_s
|
||||||
|
r1, r2 = disable_stderr {
|
||||||
|
eval(code, nil, 'generated_code_in_test_yield_enum')
|
||||||
|
}
|
||||||
assert_equal(r1, r2, "#{t}")
|
assert_equal(r1, r2, "#{t}")
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue