summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-bin-mruby/bintest
diff options
context:
space:
mode:
authorHiroshi Mimaki <[email protected]>2018-05-07 17:54:02 +0900
committerHiroshi Mimaki <[email protected]>2018-05-07 18:17:50 +0900
commitd973a8ebc4d939243f3044abf35097a76b3a7221 (patch)
tree590c7d5f615525101e2b493eb8ba15e9a3a7220f /mrbgems/mruby-bin-mruby/bintest
parentfc247449e29b26f07a9c6ba84c6dfaf0c6369f46 (diff)
downloadmruby-d973a8ebc4d939243f3044abf35097a76b3a7221.tar.gz
mruby-d973a8ebc4d939243f3044abf35097a76b3a7221.zip
Add `-r` option for `mruby` and `mirb`.
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