ci: format
This commit is contained in:
parent
7f0bd43b34
commit
8f9052bad1
2 changed files with 23 additions and 19 deletions
|
|
@ -175,9 +175,7 @@ local function restore_folds(bufnr)
|
||||||
end
|
end
|
||||||
for _, winid in ipairs(vim.fn.win_findbuf(bufnr)) do
|
for _, winid in ipairs(vim.fn.win_findbuf(bufnr)) do
|
||||||
local state = _fold_state[winid]
|
local state = _fold_state[winid]
|
||||||
if not state or next(state) == nil then
|
if state and next(state) ~= nil then
|
||||||
goto continue
|
|
||||||
end
|
|
||||||
vim.api.nvim_win_call(winid, function()
|
vim.api.nvim_win_call(winid, function()
|
||||||
vim.cmd('normal! zx')
|
vim.cmd('normal! zx')
|
||||||
local saved = vim.api.nvim_win_get_cursor(0)
|
local saved = vim.api.nvim_win_get_cursor(0)
|
||||||
|
|
@ -190,7 +188,7 @@ local function restore_folds(bufnr)
|
||||||
vim.api.nvim_win_set_cursor(0, saved)
|
vim.api.nvim_win_set_cursor(0, saved)
|
||||||
end)
|
end)
|
||||||
_fold_state[winid] = nil
|
_fold_state[winid] = nil
|
||||||
::continue::
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,10 @@ describe('parse', function()
|
||||||
|
|
||||||
it('resolves due:+2d to today plus 2 days', function()
|
it('resolves due:+2d to today plus 2 days', function()
|
||||||
local today = os.date('*t') --[[@as osdate]]
|
local today = os.date('*t') --[[@as osdate]]
|
||||||
local expected = os.date('%Y-%m-%d', os.time({ year = today.year, month = today.month, day = today.day + 2 }))
|
local expected = os.date(
|
||||||
|
'%Y-%m-%d',
|
||||||
|
os.time({ year = today.year, month = today.month, day = today.day + 2 })
|
||||||
|
)
|
||||||
local desc, meta = parse.body('Task due:+2d')
|
local desc, meta = parse.body('Task due:+2d')
|
||||||
assert.are.equal('Task', desc)
|
assert.are.equal('Task', desc)
|
||||||
assert.are.equal(expected, meta.due)
|
assert.are.equal(expected, meta.due)
|
||||||
|
|
@ -123,7 +126,10 @@ describe('parse', function()
|
||||||
|
|
||||||
it("returns today + 3 days for '+3d'", function()
|
it("returns today + 3 days for '+3d'", function()
|
||||||
local today = os.date('*t') --[[@as osdate]]
|
local today = os.date('*t') --[[@as osdate]]
|
||||||
local expected = os.date('%Y-%m-%d', os.time({ year = today.year, month = today.month, day = today.day + 3 }))
|
local expected = os.date(
|
||||||
|
'%Y-%m-%d',
|
||||||
|
os.time({ year = today.year, month = today.month, day = today.day + 3 })
|
||||||
|
)
|
||||||
local result = parse.resolve_date('+3d')
|
local result = parse.resolve_date('+3d')
|
||||||
assert.are.equal(expected, result)
|
assert.are.equal(expected, result)
|
||||||
end)
|
end)
|
||||||
|
|
@ -139,12 +145,12 @@ describe('parse', function()
|
||||||
assert.truthy(result:match('^%d%d%d%d%-%d%d%-%d%d$'))
|
assert.truthy(result:match('^%d%d%d%d%-%d%d%-%d%d$'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("returns nil for garbage input", function()
|
it('returns nil for garbage input', function()
|
||||||
local result = parse.resolve_date('notadate')
|
local result = parse.resolve_date('notadate')
|
||||||
assert.is_nil(result)
|
assert.is_nil(result)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("returns nil for empty string", function()
|
it('returns nil for empty string', function()
|
||||||
local result = parse.resolve_date('')
|
local result = parse.resolve_date('')
|
||||||
assert.is_nil(result)
|
assert.is_nil(result)
|
||||||
end)
|
end)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue