2022-05-23 21:44:15 -07:00
|
|
|
-- Modules loaded here will NOT be cleared and reloaded by Busted.
|
2015-03-01 12:49:48 -07:00
|
|
|
-- Busted started doing this to help provide more isolation. See issue #62
|
|
|
|
-- for more information about this.
|
2016-04-23 16:53:11 -07:00
|
|
|
local helpers = require('test.functional.helpers')(nil)
|
2022-11-27 02:33:54 -07:00
|
|
|
local screen = require('test.functional.ui.screen')
|
2022-05-23 21:44:15 -07:00
|
|
|
local busted = require("busted")
|
2022-11-21 17:13:30 -07:00
|
|
|
local is_os = helpers.is_os
|
2019-09-11 04:47:23 -07:00
|
|
|
|
2022-11-21 17:13:30 -07:00
|
|
|
if is_os('win') then
|
2019-09-11 04:47:23 -07:00
|
|
|
local ffi = require('ffi')
|
|
|
|
ffi.cdef[[
|
|
|
|
typedef int errno_t;
|
|
|
|
errno_t _set_fmode(int mode);
|
|
|
|
]]
|
|
|
|
ffi.C._set_fmode(0x8000)
|
|
|
|
end
|
2022-05-23 21:44:15 -07:00
|
|
|
|
|
|
|
local testid = (function()
|
|
|
|
local id = 0
|
|
|
|
return (function()
|
|
|
|
id = id + 1
|
|
|
|
return id
|
|
|
|
end)
|
|
|
|
end)()
|
|
|
|
|
|
|
|
-- Global before_each. https://github.com/Olivine-Labs/busted/issues/613
|
|
|
|
local function before_each(_element, _parent)
|
|
|
|
local id = ('T%d'):format(testid())
|
|
|
|
_G._nvim_test_id = id
|
|
|
|
return nil, true
|
|
|
|
end
|
|
|
|
busted.subscribe({ 'test', 'start' },
|
|
|
|
before_each,
|
|
|
|
{
|
|
|
|
-- Ensure our --helper is handled before --output (see busted/runner.lua).
|
|
|
|
priority = 1,
|
|
|
|
-- Don't generate a test-id for skipped tests. /shrug
|
|
|
|
predicate = function (element, _, status)
|
|
|
|
return not ((element.descriptor == 'pending' or status == 'pending'))
|
|
|
|
end
|
|
|
|
})
|