2000-08-03 13:50:41 +04:00
|
|
|
#! ./miniruby
|
1999-01-20 07:59:39 +03:00
|
|
|
|
2012-12-11 22:09:10 +04:00
|
|
|
exit if defined?(CROSS_COMPILING) and CROSS_COMPILING
|
2009-01-09 06:29:10 +03:00
|
|
|
ruby = ENV["RUBY"]
|
|
|
|
unless ruby
|
|
|
|
load './rbconfig.rb'
|
|
|
|
ruby = "./#{RbConfig::CONFIG['ruby_install_name']}#{RbConfig::CONFIG['EXEEXT']}"
|
|
|
|
end
|
2004-04-15 14:57:16 +04:00
|
|
|
unless File.exist? ruby
|
|
|
|
print "#{ruby} is not found.\n"
|
2000-06-12 11:48:31 +04:00
|
|
|
print "Try `make' first, then `make test', please.\n"
|
2004-04-15 14:57:16 +04:00
|
|
|
exit false
|
2000-06-12 11:48:31 +04:00
|
|
|
end
|
2013-09-20 18:24:10 +04:00
|
|
|
ARGV[0] and opt = ARGV[0][/\A--run-opt=(.*)/, 1] and ARGV.shift
|
2000-06-12 11:48:31 +04:00
|
|
|
|
1998-01-16 15:19:09 +03:00
|
|
|
$stderr.reopen($stdout)
|
|
|
|
error = ''
|
2000-06-12 11:48:31 +04:00
|
|
|
|
2009-05-22 15:48:42 +04:00
|
|
|
srcdir = File.expand_path('..', File.dirname(__FILE__))
|
2016-10-19 08:22:51 +03:00
|
|
|
if env = ENV["RUBYOPT"]
|
|
|
|
ENV["RUBYOPT"] = env + " -W1"
|
2016-08-07 13:34:11 +03:00
|
|
|
end
|
2016-04-12 06:49:03 +03:00
|
|
|
`#{ruby} #{opt} -W1 #{srcdir}/basictest/test.rb #{ARGV.join(' ')}`.each_line do |line|
|
1998-01-16 15:19:09 +03:00
|
|
|
if line =~ /^end of test/
|
2007-07-06 13:23:53 +04:00
|
|
|
print "\ntest succeeded\n"
|
2004-04-15 14:57:16 +04:00
|
|
|
exit true
|
1998-01-16 15:19:09 +03:00
|
|
|
end
|
2016-01-16 04:37:47 +03:00
|
|
|
error << line if %r:^(basictest/test.rb|not): =~ line
|
1998-01-16 15:19:09 +03:00
|
|
|
end
|
2012-02-20 19:59:15 +04:00
|
|
|
puts
|
1998-01-16 15:19:09 +03:00
|
|
|
print error
|
|
|
|
print "test failed\n"
|
2004-04-15 14:57:16 +04:00
|
|
|
exit false
|