Unverified Commit ff15a586 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto Committed by GitHub

Merge pull request #4841 from shuujii/fix-ARGV-value-in-mruby-command-regression-by-4827

Fix `ARGV` value in `mruby` command (regression by #4827)
parents a89d15cd f9bd4143
......@@ -39,6 +39,11 @@ assert '$0 value' do
assert_equal '"-e"', `#{cmd('mruby')} -e #{shellquote('p $0')}`.chomp
end
assert 'ARGV value' do
assert_mruby(%{["ab", "cde"]\n}, "", true, %w[-e p(ARGV) ab cde])
assert_mruby("[]\n", "", true, %w[-e p(ARGV)])
end
assert('float literal') do
script, bin = Tempfile.new('test.rb'), Tempfile.new('test.mrb')
File.write script.path, 'p [3.21, 2e308.infinite?, -2e308.infinite?]'
......
......@@ -189,8 +189,8 @@ parse_args(mrb_state *mrb, int argc, char **argv, struct _args *args)
}
}
argc = opts->argc; argv = opts->argv;
if (args->cmdline == NULL) {
argc = opts->argc; argv = opts->argv;
if (*argv == NULL) args->rfp = stdin;
else {
args->rfp = strcmp(argv[0], "-") == 0 ?
......
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