mirror of
https://github.com/neovim/neovim.git
synced 2026-08-02 13:49:19 +00:00
Problem: The magic globals `it`, `describe`, etc., are more trouble than they are worth. - Hooking into `after_each` requires `getfenv()` hacks. - They confuse luals/emmylua, because the top-level `.luarc.json` isn't merged with `test/.luarc.json` (apparently a luals limitation?) - They totally defeat discoverability because the user just has to "know" about the various magic symbols. So they harm DX, which means they serve no purpose at all. Solution: - Expose the test API from `testutil`, so tests can call `t.it()`, `t.describe()`, etc., in the conventional way. - Drop `getfenv()` hacks. - Drop the `setfenv()` injection in `load_chunk`. - Drop `test/_meta.lua`.
82 lines
2.1 KiB
Lua
82 lines
2.1 KiB
Lua
-- See also: test/old/testdir/test_options.vim
|
|
local t = require('test.testutil')
|
|
local n = require('test.functional.testnvim')()
|
|
local Screen = require('test.functional.ui.screen')
|
|
|
|
local describe, it, before_each, setup = t.describe, t.it, t.before_each, t.setup
|
|
local command, clear = n.command, n.clear
|
|
local source, expect = n.source, n.expect
|
|
local matches = t.matches
|
|
local pcall_err = t.pcall_err
|
|
|
|
describe('options', function()
|
|
setup(clear)
|
|
|
|
it('should not throw any exception', function()
|
|
command('options')
|
|
end)
|
|
end)
|
|
|
|
describe('set', function()
|
|
before_each(clear)
|
|
|
|
it("should keep two comma when 'path' is changed", function()
|
|
source([[
|
|
set path=foo,,bar
|
|
set path-=bar
|
|
set path+=bar
|
|
$put =&path]])
|
|
|
|
expect([[
|
|
|
|
foo,,bar]])
|
|
end)
|
|
|
|
it('winminheight works', function()
|
|
local _ = Screen.new(20, 11)
|
|
source([[
|
|
set wmh=0 stal=2
|
|
below sp | wincmd _
|
|
below sp | wincmd _
|
|
below sp | wincmd _
|
|
below sp
|
|
]])
|
|
matches('E36: Not enough room', pcall_err(command, 'set wmh=1'))
|
|
end)
|
|
|
|
it('winminheight works with tabline', function()
|
|
local _ = Screen.new(20, 11)
|
|
source([[
|
|
set wmh=0 stal=2
|
|
split
|
|
split
|
|
split
|
|
split
|
|
tabnew
|
|
]])
|
|
matches('E36: Not enough room', pcall_err(command, 'set wmh=1'))
|
|
end)
|
|
|
|
it('scroll works', function()
|
|
local screen = Screen.new(42, 16)
|
|
source([[
|
|
set scroll=2
|
|
set laststatus=2
|
|
]])
|
|
command('verbose set scroll?')
|
|
screen:expect([[
|
|
|
|
|
{1:~ }|*11
|
|
{3: }|
|
|
scroll=7 |
|
|
Last set from changed window size |
|
|
{6:Press ENTER or type command to continue}^ |
|
|
]])
|
|
end)
|
|
|
|
it('foldcolumn and signcolumn to empty string is disallowed', function()
|
|
matches('E474: Invalid argument: fdc=', pcall_err(command, 'set fdc='))
|
|
matches('E474: Invalid argument: scl=', pcall_err(command, 'set scl='))
|
|
end)
|
|
end)
|