mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Merge pull request #2105 from take-cheeze/issue_2103_test
Add test of $0 value in bin/mruby related to #2103 .
This commit is contained in:
@@ -14,3 +14,19 @@ assert('regression for #1572') do
|
||||
o = `bin/mruby -b #{bin.path}`.strip
|
||||
assert_equal o, '"ok"'
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user