aboutsummaryrefslogtreecommitdiff
path: root/test/functional/core/startup_spec.lua
diff options
context:
space:
mode:
authorMike <Mike325@users.noreply.github.com>2023-06-26 11:38:48 +0200
committerGitHub <noreply@github.com>2023-06-26 02:38:48 -0700
commitaa65bd478a9860ff4d2490bb49049c78654e811d (patch)
treec58601e8274e2cef587730f81718583f7af1ed9e /test/functional/core/startup_spec.lua
parentb6878f5d6387bad667edf75cf6c70e846c3b0428 (diff)
downloadrneovim-aa65bd478a9860ff4d2490bb49049c78654e811d.tar.gz
rneovim-aa65bd478a9860ff4d2490bb49049c78654e811d.tar.bz2
rneovim-aa65bd478a9860ff4d2490bb49049c78654e811d.zip
fix(startup): "nvim -l foo.lua" may not set arg0 #24161
Problem: Using "nvim -l args.lua" without passing extra script args, does not set `_G.arg[0]`. Steps to reproduce: ``` cat > args.lua<<EOF vim.print(_G.arg, '') vim.print(vim.v.argv, '') EOF nvim --clean -l args.lua ``` Solution: Fix condition in command_line_scan.
Diffstat (limited to 'test/functional/core/startup_spec.lua')
-rw-r--r--test/functional/core/startup_spec.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/functional/core/startup_spec.lua b/test/functional/core/startup_spec.lua
index 58bf7f8681..ef3c2eadd9 100644
--- a/test/functional/core/startup_spec.lua
+++ b/test/functional/core/startup_spec.lua
@@ -144,6 +144,18 @@ describe('startup', function()
end)
it('sets _G.arg', function()
+ -- nvim -l foo.lua
+ assert_l_out([[
+ bufs:
+ nvim args: 3
+ lua args: {
+ [0] = "test/functional/fixtures/startup.lua"
+ }]],
+ {},
+ {}
+ )
+ eq(0, eval('v:shell_error'))
+
-- nvim -l foo.lua [args]
assert_l_out([[
bufs: