summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-01-27 12:04:17 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-01-27 12:04:17 +0000
commitbf4a6a0557355a2945dedabe1e494417deaf7073 (patch)
tree217f386d2635d74a0b5eb2d0f7ac43cca2161433 /test
parent1d3c2678e2e23484098260df337f383c2f5b2c60 (diff)
suppress warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_system.rb4
-rw-r--r--test/ruby/test_yield.rb32
2 files changed, 26 insertions, 10 deletions
diff --git a/test/ruby/test_system.rb b/test/ruby/test_system.rb
index 0fbad0af33..1819982250 100644
--- a/test/ruby/test_system.rb
+++ b/test/ruby/test_system.rb
@@ -37,7 +37,7 @@ class TestSystem < Test::Unit::TestCase
tmp = open(tmpfilename, "w")
tmp.print "this is a leading junk\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 "this is a trailing junk\n";
tmp.close
@@ -49,7 +49,7 @@ class TestSystem < Test::Unit::TestCase
tmp.print "#! /non/exist\\interpreter?/./to|be:ignored\n";
tmp.print "this is a leading junk\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 "this is a trailing junk\n";
tmp.close
diff --git a/test/ruby/test_yield.rb b/test/ruby/test_yield.rb
index 2a2c6ae80f..3337aea078 100644
--- a/test/ruby/test_yield.rb
+++ b/test/ruby/test_yield.rb
@@ -1,4 +1,5 @@
require 'test/unit'
+require 'stringio'
class TestRubyYield < Test::Unit::TestCase
@@ -209,8 +210,8 @@ class TestRubyYieldGen < Test::Unit::TestCase
if args.last == []
args = args[0...-1]
end
- code = "emu_return_args #{args.map {|a| a.join('') }.join(",")}"
- eval code
+ code = "emu_return_args(#{args.map {|a| a.join('') }.join(",")})"
+ eval code, nil, 'generated_code_in_emu_eval_args'
end
def emu_bind_single(arg, param, result_binding)
@@ -324,6 +325,16 @@ class TestRubyYieldGen < Test::Unit::TestCase
}
end
+ def disable_stderr
+ begin
+ save_stderr = $stderr
+ $stderr = StringIO.new
+ yield
+ ensure
+ $stderr = save_stderr
+ end
+ end
+
def check_nofork(t, islambda=false)
t, vars = rename_var(t)
t = t.subst('vars') { " [#{vars.join(",")}]" }
@@ -331,11 +342,13 @@ class TestRubyYieldGen < Test::Unit::TestCase
s = t.to_s
#print "#{s}\t\t"
#STDOUT.flush
- begin
- eval_values = eval(s)
- rescue ArgumentError
- eval_values = ArgumentError
- end
+ eval_values = disable_stderr {
+ begin
+ eval(s, nil, 'generated_code_in_check_nofork')
+ rescue ArgumentError
+ ArgumentError
+ end
+ }
#success = emu_values == eval_values ? 'succ' : 'fail'
#puts "eval:#{vs_ev.inspect[1...-1].delete(' ')}\temu:#{vs_emu.inspect[1...-1].delete(' ')}\t#{success}"
assert_equal(emu_values, eval_values, s)
@@ -358,7 +371,10 @@ class TestRubyYieldGen < Test::Unit::TestCase
def test_yield_enum
syntax = Sentence.expand_syntax(Syntax)
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}")
}
end