aboutsummaryrefslogtreecommitdiff
path: root/test/functional/core/startup_spec.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2023-01-07 02:12:54 +0100
committerJustin M. Keyes <justinkz@gmail.com>2023-01-07 03:03:38 +0100
commite17430c1cd97db5624e27515a4f5da17f9d926d6 (patch)
tree44196a84757ee1130827451635e4a5090e7fc8b0 /test/functional/core/startup_spec.lua
parent7fc5d6ea50f5d04ad1d4a71fd0429bfd72f2c66e (diff)
downloadrneovim-e17430c1cd97db5624e27515a4f5da17f9d926d6.tar.gz
rneovim-e17430c1cd97db5624e27515a4f5da17f9d926d6.tar.bz2
rneovim-e17430c1cd97db5624e27515a4f5da17f9d926d6.zip
feat(lua): store "nvim -l" scriptname in _G.arg[0]
Diffstat (limited to 'test/functional/core/startup_spec.lua')
-rw-r--r--test/functional/core/startup_spec.lua50
1 files changed, 20 insertions, 30 deletions
diff --git a/test/functional/core/startup_spec.lua b/test/functional/core/startup_spec.lua
index d7e64c6b54..9dabcd28b3 100644
--- a/test/functional/core/startup_spec.lua
+++ b/test/functional/core/startup_spec.lua
@@ -108,7 +108,9 @@ describe('startup', function()
assert_l_out([[
bufs:
nvim args: 7
- lua args: { "-arg1", "--exitcode", "73", "--arg2" }]],
+ lua args: { "-arg1", "--exitcode", "73", "--arg2",
+ [0] = "test/functional/fixtures/startup.lua"
+ }]],
{},
{ '-arg1', "--exitcode", "73", '--arg2' }
)
@@ -126,11 +128,11 @@ describe('startup', function()
end)
it('executes stdin "-"', function()
- assert_l_out('args=2 whoa',
+ assert_l_out('arg0=- args=2 whoa',
nil,
{ 'arg1', 'arg 2' },
'-',
- "print(('args=%d %s'):format(#_G.arg, 'whoa'))")
+ "print(('arg0=%s args=%d %s'):format(_G.arg[0], #_G.arg, 'whoa'))")
assert_l_out('biiig input: 1000042',
nil,
nil,
@@ -140,23 +142,15 @@ describe('startup', function()
end)
it('sets _G.arg', function()
- -- nvim -l foo.lua -arg1 -- a b c
- assert_l_out([[
- bufs:
- nvim args: 6
- lua args: { "-arg1", "--arg2", "arg3" }]],
- {},
- { '-arg1', '--arg2', 'arg3' }
- )
- eq(0, eval('v:shell_error'))
-
- -- nvim -l foo.lua --
+ -- nvim -l foo.lua [args]
assert_l_out([[
bufs:
- nvim args: 4
- lua args: { "--" }]],
+ nvim args: 7
+ lua args: { "-arg1", "--arg2", "--", "arg3",
+ [0] = "test/functional/fixtures/startup.lua"
+ }]],
{},
- { '--' }
+ { '-arg1', '--arg2', '--', 'arg3' }
)
eq(0, eval('v:shell_error'))
@@ -164,27 +158,21 @@ describe('startup', function()
assert_l_out([[
bufs: file1 file2
nvim args: 10
- lua args: { "-arg1", "arg 2", "--", "file3", "file4" }]],
+ lua args: { "-arg1", "arg 2", "--", "file3", "file4",
+ [0] = "test/functional/fixtures/startup.lua"
+ }]],
{ 'file1', 'file2', },
{ '-arg1', 'arg 2', '--', 'file3', 'file4' }
)
eq(0, eval('v:shell_error'))
- -- nvim file1 file2 -l foo.lua -arg1 --
- assert_l_out([[
- bufs: file1 file2
- nvim args: 7
- lua args: { "-arg1", "--" }]],
- { 'file1', 'file2', },
- { '-arg1', '--' }
- )
- eq(0, eval('v:shell_error'))
-
-- nvim -l foo.lua <vim args>
assert_l_out([[
bufs:
nvim args: 5
- lua args: { "-c", "set wrap?" }]],
+ lua args: { "-c", "set wrap?",
+ [0] = "test/functional/fixtures/startup.lua"
+ }]],
{},
{ '-c', 'set wrap?' }
)
@@ -198,7 +186,9 @@ describe('startup', function()
bufs:
nvim args: 7
- lua args: { "-c", "set wrap?" }]],
+ lua args: { "-c", "set wrap?",
+ [0] = "test/functional/fixtures/startup.lua"
+ }]],
{ '-c', 'set wrap?' },
{ '-c', 'set wrap?' }
)