summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2014-03-03 21:00:20 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2014-03-03 21:00:20 +0900
commit0cc34d64a2d9a6ce33e8bc3e328c02fd788e96dd (patch)
tree25f033cf41d1d0e06e435b43dff571effe393481
parent369c6c3649b5abbca290589585d9a7d365b3e9db (diff)
parent24e3e33cb654cd54aca76acb5390852b8b913bb9 (diff)
downloadmruby-0cc34d64a2d9a6ce33e8bc3e328c02fd788e96dd.tar.gz
mruby-0cc34d64a2d9a6ce33e8bc3e328c02fd788e96dd.zip
Merge pull request #1787 from take-cheeze/bintest_improvement
`bintest` improvement.
-rw-r--r--mrbgems/mruby-bin-mruby/bintest/mruby.rb9
-rw-r--r--mrbgems/mruby-bin-strip/bintest/mruby-strip.rb1
-rw-r--r--tasks/mruby_build.rake3
-rw-r--r--test/bintest.rb6
4 files changed, 13 insertions, 6 deletions
diff --git a/mrbgems/mruby-bin-mruby/bintest/mruby.rb b/mrbgems/mruby-bin-mruby/bintest/mruby.rb
index 2eb41d758..22872c389 100644
--- a/mrbgems/mruby-bin-mruby/bintest/mruby.rb
+++ b/mrbgems/mruby-bin-mruby/bintest/mruby.rb
@@ -1,3 +1,5 @@
+require 'tempfile'
+
assert('regression for #1564') do
o = `bin/mruby -e '<<' 2>&1`
assert_equal o, "-e:1:2: syntax error, unexpected tLSHFT\n"
@@ -6,8 +8,9 @@ assert('regression for #1564') do
end
assert('regression for #1572') do
- system "echo 'p \"ok\"' > /tmp/1572.rb"
- system "bin/mrbc -g -o /tmp/1572.mrb /tmp/1572.rb"
- o = `bin/mruby -b /tmp/1572.mrb`.strip
+ script, bin = Tempfile.new('test.rb'), Tempfile.new('test.mrb')
+ system "echo 'p \"ok\"' > #{script.path}"
+ system "bin/mrbc -g -o #{bin.path} #{script.path}"
+ o = `bin/mruby -b #{bin.path}`.strip
assert_equal o, '"ok"'
end
diff --git a/mrbgems/mruby-bin-strip/bintest/mruby-strip.rb b/mrbgems/mruby-bin-strip/bintest/mruby-strip.rb
index 4f27d2fce..17bd0e71f 100644
--- a/mrbgems/mruby-bin-strip/bintest/mruby-strip.rb
+++ b/mrbgems/mruby-bin-strip/bintest/mruby-strip.rb
@@ -32,6 +32,7 @@ assert('success') do
o = `bin/mruby-strip #{compiled1.path}`
assert_equal 0, $?.exitstatus
assert_equal "", o
+ assert_equal `bin/mruby #{script_file.path}`, `bin/mruby -b #{compiled1.path}`
o = `bin/mruby-strip #{compiled1.path} #{compiled2.path}`
assert_equal 0, $?.exitstatus
diff --git a/tasks/mruby_build.rake b/tasks/mruby_build.rake
index c65ad4c20..432100f8d 100644
--- a/tasks/mruby_build.rake
+++ b/tasks/mruby_build.rake
@@ -194,7 +194,8 @@ module MRuby
end
def run_bintest
- sh "ruby test/bintest.rb"
+ targets = @gems.select { |v| Dir.exists? "#{v.dir}/bintest" }.map { |v| filename v.dir }
+ sh "ruby test/bintest.rb #{targets.join ' '}"
end
def print_build_summary
diff --git a/test/bintest.rb b/test/bintest.rb
index e9dbb285e..0ff3341a0 100644
--- a/test/bintest.rb
+++ b/test/bintest.rb
@@ -1,8 +1,10 @@
$:.unshift File.dirname(File.dirname(File.expand_path(__FILE__)))
require 'test/assert.rb'
-Dir['mrbgems/**/bintest/*.rb'].each do |file|
- load file
+ARGV.each do |gem|
+ Dir["#{gem}/bintest/*.rb"].each do |file|
+ load file
+ end
end
load 'test/report.rb'