summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-bin-mruby/bintest
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2018-05-09 18:31:34 +0800
committerGitHub <[email protected]>2018-05-09 18:31:34 +0800
commitbda88bdbea748be5457fec36e70409cc2118bade (patch)
tree7216df5db601d76dad108dbb55a05761d87ba392 /mrbgems/mruby-bin-mruby/bintest
parentfc247449e29b26f07a9c6ba84c6dfaf0c6369f46 (diff)
parente76492c7761ea4ae11ef32351317583062424ee1 (diff)
downloadmruby-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')
-rw-r--r--mrbgems/mruby-bin-mruby/bintest/mruby.rb23
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