source: EcnlProtoTool/trunk/mruby-2.1.1/mrbgems/mruby-bin-mirb/bintest/mirb.rb@ 439

Last change on this file since 439 was 439, checked in by coas-nagasima, 4 years ago

mrubyを2.1.1に更新

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-ruby;charset=UTF-8
File size: 835 bytes
Line 
1require 'open3'
2
3assert('mirb normal operations') do
4 o, s = Open3.capture2('bin/mirb', :stdin_data => "a=1\nb=2\na+b\n")
5 assert_true o.include?('=> 3')
6 assert_true o.include?('=> 2')
7end
8
9assert('regression for #1563') do
10 o, s = Open3.capture2('bin/mirb', :stdin_data => "a=1;b=2;c=3\nb\nc")
11 assert_true o.include?('=> 3')
12end
13
14assert('mirb -d option') do
15 o, _ = Open3.capture2('bin/mirb', :stdin_data => "$DEBUG\n")
16 assert_true o.include?('=> false')
17 o, _ = Open3.capture2('bin/mirb -d', :stdin_data => "$DEBUG\n")
18 assert_true o.include?('=> true')
19end
20
21assert('mirb -r option') do
22 lib = Tempfile.new('lib.rb')
23 lib.write <<EOS
24class Hoge
25 def hoge
26 :hoge
27 end
28end
29EOS
30 lib.flush
31
32 o, _ = Open3.capture2("bin/mirb -r #{lib.path}", :stdin_data => "Hoge.new.hoge\n")
33 assert_true o.include?('=> :hoge')
34end
Note: See TracBrowser for help on using the repository browser.