diff options
| author | take_cheeze <[email protected]> | 2014-05-15 15:09:08 +0900 |
|---|---|---|
| committer | take_cheeze <[email protected]> | 2014-05-15 15:15:06 +0900 |
| commit | e0064acac71a28b75797c3e3ea1b8aca1ce8a796 (patch) | |
| tree | b40492fef958e057ec4cab5a4d9d1298bc8a6995 /mrbgems/mruby-bin-strip/bintest | |
| parent | 30e0dc79566430a176dd2cfab593cd3620ba69da (diff) | |
| download | mruby-e0064acac71a28b75797c3e3ea1b8aca1ce8a796.tar.gz mruby-e0064acac71a28b75797c3e3ea1b8aca1ce8a796.zip | |
Implement `LVAR` section removing option in mruby-strip.
Diffstat (limited to 'mrbgems/mruby-bin-strip/bintest')
| -rw-r--r-- | mrbgems/mruby-bin-strip/bintest/mruby-strip.rb | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/mrbgems/mruby-bin-strip/bintest/mruby-strip.rb b/mrbgems/mruby-bin-strip/bintest/mruby-strip.rb index 17bd0e71f..770ea0638 100644 --- a/mrbgems/mruby-bin-strip/bintest/mruby-strip.rb +++ b/mrbgems/mruby-bin-strip/bintest/mruby-strip.rb @@ -3,7 +3,7 @@ require 'tempfile' assert('no files') do o = `bin/mruby-strip 2>&1` assert_equal 1, $?.exitstatus - assert_equal "no files to strip\n", o + assert_equal "no files to strip", o.split("\n")[0] end assert('file not found') do @@ -52,3 +52,22 @@ assert('check debug section') do `bin/mruby-strip #{with_debug.path}` assert_equal without_debug.size, with_debug.size end + +assert('check lv section') do + script_file, with_lv, without_lv = + Tempfile.new('script.rb'), Tempfile.new('c1.mrb'), Tempfile.new('c2.mrb') + script_file.write <<EOS +a, b = 0, 1 +a += b +p Kernel.local_variables +EOS + script_file.flush + `bin/mrbc -o #{with_lv.path} #{script_file.path}` + `bin/mrbc -o #{without_lv.path} #{script_file.path}` + + `bin/mruby-strip -l #{without_lv.path}` + assert_true without_lv.size < with_lv.size + + assert_equal '[:a, :b]', `bin/mruby -b #{with_lv.path}`.chomp + assert_equal '[]', `bin/mruby -b #{without_lv.path}`.chomp +end |
