diff options
Diffstat (limited to 'test/functional/autocmd/show_spec.lua')
-rw-r--r-- | test/functional/autocmd/show_spec.lua | 66 |
1 files changed, 40 insertions, 26 deletions
diff --git a/test/functional/autocmd/show_spec.lua b/test/functional/autocmd/show_spec.lua index 9e0a5b819a..1a9dc8a337 100644 --- a/test/functional/autocmd/show_spec.lua +++ b/test/functional/autocmd/show_spec.lua @@ -5,29 +5,30 @@ local clear = helpers.clear local command = helpers.command local dedent = helpers.dedent local eq = helpers.eq -local funcs = helpers.funcs +local fn = helpers.fn local eval = helpers.eval local exec = helpers.exec local feed = helpers.feed -describe(":autocmd", function() +describe(':autocmd', function() before_each(function() - clear({'-u', 'NONE'}) + clear({ '-u', 'NONE' }) end) - it("should not segfault when you just do autocmd", function() - command ":autocmd" + it('should not segfault when you just do autocmd', function() + command ':autocmd' end) - it("should filter based on ++once", function() - command "autocmd! BufEnter" + it('should filter based on ++once', function() + command 'autocmd! BufEnter' command "autocmd BufEnter * :echo 'Hello'" command [[augroup TestingOne]] command [[ autocmd BufEnter * :echo "Line 1"]] command [[ autocmd BufEnter * :echo "Line 2"]] command [[augroup END]] - eq(dedent([[ + eq( + dedent([[ --- Autocommands --- BufEnter @@ -35,15 +36,16 @@ describe(":autocmd", function() TestingOne BufEnter * :echo "Line 1" :echo "Line 2"]]), - funcs.execute('autocmd BufEnter')) + fn.execute('autocmd BufEnter') + ) end) it('should not show group information if interrupted', function() local screen = Screen.new(50, 6) screen:set_default_attr_ids({ - [1] = {bold = true, foreground = Screen.colors.Blue1}, -- NonText - [2] = {bold = true, foreground = Screen.colors.SeaGreen}, -- MoreMsg - [3] = {bold = true, foreground = Screen.colors.Magenta}, -- Title + [1] = { bold = true, foreground = Screen.colors.Blue1 }, -- NonText + [2] = { bold = true, foreground = Screen.colors.SeaGreen }, -- MoreMsg + [3] = { bold = true, foreground = Screen.colors.Magenta }, -- Title }) screen:attach() exec([[ @@ -79,10 +81,7 @@ describe(":autocmd", function() feed('q') screen:expect([[ ^ | - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| + {1:~ }|*4 | ]]) end) @@ -112,7 +111,8 @@ describe(":autocmd", function() autocmd User foo call Func() doautocmd User foo ]]) - eq(dedent([[ + eq( + dedent([[ --- Autocommands --- test_1 BufEnter @@ -122,7 +122,9 @@ describe(":autocmd", function() test_3 BufEnter D echo 'D' E echo 'E' - F echo 'F']]), eval('g:output')) + F echo 'F']]), + eval('g:output') + ) end) it('can filter by pattern #17973', function() @@ -148,7 +150,8 @@ describe(":autocmd", function() autocmd User B echo "B3" augroup END ]]) - eq(dedent([[ + eq( + dedent([[ --- Autocommands --- test_1 User @@ -156,8 +159,11 @@ describe(":autocmd", function() test_2 User A echo "A2" test_3 User - A echo "A3"]]), funcs.execute('autocmd User A')) - eq(dedent([[ + A echo "A3"]]), + fn.execute('autocmd User A') + ) + eq( + dedent([[ --- Autocommands --- test_1 BufEnter @@ -171,14 +177,19 @@ describe(":autocmd", function() test_2 User B echo "B2" test_3 User - B echo "B3"]]), funcs.execute('autocmd * B')) - eq(dedent([[ + B echo "B3"]]), + fn.execute('autocmd * B') + ) + eq( + dedent([[ --- Autocommands --- test_3 BufEnter B echo "B3" test_3 User - B echo "B3"]]), funcs.execute('autocmd test_3 * B')) + B echo "B3"]]), + fn.execute('autocmd test_3 * B') + ) end) it('should skip consecutive patterns', function() @@ -203,7 +214,8 @@ describe(":autocmd", function() let g:output = execute('autocmd BufEnter') ]]) - eq(dedent([[ + eq( + dedent([[ --- Autocommands --- test_1 BufEnter @@ -219,6 +231,8 @@ describe(":autocmd", function() echo 'C' D echo 'D' echo 'E' - echo 'F']]), eval('g:output')) + echo 'F']]), + eval('g:output') + ) end) end) |