diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-04-02 06:28:15 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-04-02 06:28:15 +0000 |
commit | a26d663b70af61824bbb722d22d13d068e19cccd (patch) | |
tree | 6c82a5e5f2509da9d9202642d41eb1dfb28e7323 /test/ruby/envutil.rb | |
parent | 63f33c5e461dc7c84bdb31f5d5fb4f163ada9157 (diff) |
* test/ruby/envutil.rb (assert_separately): stop_auto_run of
Test::Unit::Runner to prevent auto runner use ARGV.
* test/ruby/envutil.rb (assert_separately): add $: to separate process.
* test/ruby/envutil.rb (assert_separately): fail if stderr is not
empty and ignore_stderr is false.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/envutil.rb')
-rw-r--r-- | test/ruby/envutil.rb | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/test/ruby/envutil.rb b/test/ruby/envutil.rb index c7ffc41598..0ae5119ff6 100644 --- a/test/ruby/envutil.rb +++ b/test/ruby/envutil.rb @@ -287,17 +287,31 @@ module Test ensure puts [Marshal.dump($!)].pack('m'), "assertions=\#{self._assertions}" end + class Test::Unit::Runner + @@stop_auto_run = true + end eom + args = args.dup + $:.each{|l| args.unshift "-I#{l}" } + ignore_stderr = opt.delete(:ignore_stderr) stdout, stderr, status = EnvUtil.invoke_ruby(args, src, true, true, opt) abort = status.coredump? || (status.signaled? && ABORT_SIGNALS.include?(status.termsig)) assert(!abort, FailDesc[status, stderr]) self._assertions += stdout[/^assertions=(\d+)/, 1].to_i res = Marshal.load(stdout.unpack("m")[0]) - return unless res - res.backtrace.each do |l| - l.sub!(/\A-:(\d+)/){"#{file}:#{line + $1.to_i}"} + if res + res.backtrace.each do |l| + l.sub!(/\A-:(\d+)/){"#{file}:#{line + $1.to_i}"} + end + raise res + end + + # really is it succeed? + unless ignore_stderr + # the body of assert_separately must not output anything to detect errror + assert_equal("", stderr, "assert_separately failed with error message") end - raise res + assert_equal(0, status, "assert_separately failed: '#{stderr}'") end def assert_warning(pat, msg = nil) |