Commit f2204ee5 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto

Merge pull request #2105 from take-cheeze/issue_2103_test

Add test of $0 value in bin/mruby related to #2103 .
parents 68027317 18718e06
...@@ -14,3 +14,19 @@ assert('regression for #1572') do ...@@ -14,3 +14,19 @@ assert('regression for #1572') do
o = `bin/mruby -b #{bin.path}`.strip o = `bin/mruby -b #{bin.path}`.strip
assert_equal o, '"ok"' assert_equal o, '"ok"'
end end
assert '$0 value' do
script, bin = Tempfile.new('test.rb'), Tempfile.new('test.mrb')
# .rb script
script.write "p $0\n"
script.flush
assert_equal "\"#{script.path}\"", `./bin/mruby "#{script.path}"`.chomp
# .mrb file
`./bin/mrbc -o "#{bin.path}" "#{script.path}"`
assert_equal "\"#{bin.path}\"", `./bin/mruby -b "#{bin.path}"`.chomp
# one liner
assert_equal '"-e"', `./bin/mruby -e 'p $0'`.chomp
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment