summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-bin-mruby/bintest/mruby.rb
diff options
context:
space:
mode:
Diffstat (limited to 'mrbgems/mruby-bin-mruby/bintest/mruby.rb')
-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