diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2024-01-03 02:09:18 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2024-01-03 02:09:29 +0100 |
commit | 04f2f864e270e772c6326cefdf24947f0130e492 (patch) | |
tree | 46f83f909b888a66c741032ab955afc6eab84292 /test/functional/editor/ctrl_c_spec.lua | |
parent | 59d117ec99b6037cb9fad5bbfb6d0b18f5012927 (diff) | |
download | rneovim-04f2f864e270e772c6326cefdf24947f0130e492.tar.gz rneovim-04f2f864e270e772c6326cefdf24947f0130e492.tar.bz2 rneovim-04f2f864e270e772c6326cefdf24947f0130e492.zip |
refactor: format test/*
Diffstat (limited to 'test/functional/editor/ctrl_c_spec.lua')
-rw-r--r-- | test/functional/editor/ctrl_c_spec.lua | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/test/functional/editor/ctrl_c_spec.lua b/test/functional/editor/ctrl_c_spec.lua index c399a35462..0321a21b35 100644 --- a/test/functional/editor/ctrl_c_spec.lua +++ b/test/functional/editor/ctrl_c_spec.lua @@ -5,7 +5,7 @@ local command = helpers.command local poke_eventloop = helpers.poke_eventloop local sleep = helpers.sleep -describe("CTRL-C (mapped)", function() +describe('CTRL-C (mapped)', function() local screen before_each(function() @@ -14,7 +14,7 @@ describe("CTRL-C (mapped)", function() screen:attach() end) - it("interrupts :global", function() + it('interrupts :global', function() -- Crashes luajit. if helpers.skip_fragile(pending) then return @@ -25,7 +25,7 @@ describe("CTRL-C (mapped)", function() nnoremap <C-C> <NOP> ]]) - command("silent edit! test/functional/fixtures/bigfile.txt") + command('silent edit! test/functional/fixtures/bigfile.txt') screen:expect([[ ^0000;<control>;Cc;0;BN;;;;;N;NULL;;;; | @@ -37,19 +37,21 @@ describe("CTRL-C (mapped)", function() ]]) local function test_ctrl_c(ms) - feed(":global/^/p<CR>") + feed(':global/^/p<CR>') screen:sleep(ms) - feed("<C-C>") - screen:expect{any="Interrupt"} + feed('<C-C>') + screen:expect { any = 'Interrupt' } end -- The test is time-sensitive. Try different sleep values. - local ms_values = {100, 1000, 10000} + local ms_values = { 100, 1000, 10000 } for i, ms in ipairs(ms_values) do if i < #ms_values then local status, _ = pcall(test_ctrl_c, ms) - if status then break end - else -- Call the last attempt directly. + if status then + break + end + else -- Call the last attempt directly. test_ctrl_c(ms) end end @@ -58,9 +60,9 @@ describe("CTRL-C (mapped)", function() it('interrupts :sleep', function() command('nnoremap <C-C> <Nop>') feed(':sleep 100<CR>') - poke_eventloop() -- wait for :sleep to start + poke_eventloop() -- wait for :sleep to start feed('foo<C-C>') - poke_eventloop() -- wait for input buffer to be flushed + poke_eventloop() -- wait for input buffer to be flushed feed('i') screen:expect([[ ^ | @@ -73,9 +75,9 @@ describe("CTRL-C (mapped)", function() command('nnoremap <C-C> <Nop>') command('nmap <F2> <Ignore><F2>') feed('<F2>') - sleep(10) -- wait for the key to enter typeahead + sleep(10) -- wait for the key to enter typeahead feed('foo<C-C>') - poke_eventloop() -- wait for input buffer to be flushed + poke_eventloop() -- wait for input buffer to be flushed feed('i') screen:expect([[ ^ | |