diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2018-05-09 18:31:34 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2018-05-09 18:31:34 +0800 |
| commit | bda88bdbea748be5457fec36e70409cc2118bade (patch) | |
| tree | 7216df5db601d76dad108dbb55a05761d87ba392 /mrbgems/mruby-bin-mruby/bintest/mruby.rb | |
| parent | fc247449e29b26f07a9c6ba84c6dfaf0c6369f46 (diff) | |
| parent | e76492c7761ea4ae11ef32351317583062424ee1 (diff) | |
| download | mruby-bda88bdbea748be5457fec36e70409cc2118bade.tar.gz mruby-bda88bdbea748be5457fec36e70409cc2118bade.zip | |
Merge pull request #4022 from mimaki/mruby-r-option
Add `-r` option for `mruby` and `mirb`. (mrbgem is not supported)
Diffstat (limited to 'mrbgems/mruby-bin-mruby/bintest/mruby.rb')
| -rw-r--r-- | mrbgems/mruby-bin-mruby/bintest/mruby.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/mrbgems/mruby-bin-mruby/bintest/mruby.rb b/mrbgems/mruby-bin-mruby/bintest/mruby.rb index ca11ce2e7..a7fb63fa2 100644 --- a/mrbgems/mruby-bin-mruby/bintest/mruby.rb +++ b/mrbgems/mruby-bin-mruby/bintest/mruby.rb @@ -65,3 +65,26 @@ assert('mruby -d option') do o = `#{cmd('mruby')} -d -e #{shellquote('p $DEBUG')}` assert_equal "true\n", o end + +assert('mruby -r option') do + lib = Tempfile.new('lib.rb') + lib.write <<EOS +class Hoge + def hoge + :hoge + end +end +EOS + lib.flush + + script = Tempfile.new('test.rb') + script.write <<EOS +print Hoge.new.hoge +EOS + script.flush + assert_equal 'hoge', `#{cmd('mruby')} -r #{lib.path} #{script.path}` + assert_equal 0, $?.exitstatus + + assert_equal 'hogeClass', `#{cmd('mruby')} -r #{lib.path} -r #{script.path} -e #{shellquote('print Hoge.class')}` + assert_equal 0, $?.exitstatus +end |
