Skip to content

Commit 5f12572

Browse files
committed
Import MRI bootstraptest and basictest
1 parent 9c40839 commit 5f12572

32 files changed

+9814
-0
lines changed

test/basictest/runner.rb

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#! ./miniruby
2+
3+
exit if defined?(CROSS_COMPILING) and CROSS_COMPILING
4+
ruby = ENV["RUBY"]
5+
unless ruby
6+
load './rbconfig.rb'
7+
ruby = "./#{RbConfig::CONFIG['ruby_install_name']}#{RbConfig::CONFIG['EXEEXT']}"
8+
end
9+
unless File.exist? ruby
10+
print "#{ruby} is not found.\n"
11+
print "Try `make' first, then `make test', please.\n"
12+
exit false
13+
end
14+
ARGV[0] and opt = ARGV[0][/\A--run-opt=(.*)/, 1] and ARGV.shift
15+
16+
$stderr.reopen($stdout)
17+
error = ''
18+
19+
srcdir = File.expand_path('..', File.dirname(__FILE__))
20+
if env = ENV["RUBYOPT"]
21+
ENV["RUBYOPT"] = env + " -W1"
22+
end
23+
`#{ruby} #{opt} -W1 #{srcdir}/basictest/test.rb #{ARGV.join(' ')}`.each_line do |line|
24+
if line =~ /^end of test/
25+
print "\ntest succeeded\n"
26+
exit true
27+
end
28+
error << line if %r:^(basictest/test.rb|not): =~ line
29+
end
30+
puts
31+
print error
32+
print "test failed\n"
33+
exit false

0 commit comments

Comments
 (0)