From d67e48379f50b83f955d322de9e23b7a7013d39c Mon Sep 17 00:00:00 2001 From: James McCoy Date: Sun, 9 Apr 2017 01:04:26 -0400 Subject: test: shada: Replace hard-coded 704 with dynamic version --- test/functional/plugin/shada_spec.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'test/functional/plugin') diff --git a/test/functional/plugin/shada_spec.lua b/test/functional/plugin/shada_spec.lua index 639833071b..dbc78e63f0 100644 --- a/test/functional/plugin/shada_spec.lua +++ b/test/functional/plugin/shada_spec.lua @@ -2076,13 +2076,14 @@ describe('In autoload/shada.vim', function() end it('works', function() + local version = nvim('get_vvar', 'version') getbstrings_eq({{timestamp='current', type=1, value={ generator='shada.vim', - version=704, + version=version, }}}, {}) getbstrings_eq({ {timestamp='current', type=1, value={ - generator='shada.vim', version=704 + generator='shada.vim', version=version }}, {timestamp=0, type=1, value={generator='test'}} }, { @@ -2093,11 +2094,11 @@ describe('In autoload/shada.vim', function() nvim('set_var', 'shada#add_own_header', 1) getbstrings_eq({{timestamp='current', type=1, value={ generator='shada.vim', - version=704, + version=version, }}}, {}) getbstrings_eq({ {timestamp='current', type=1, value={ - generator='shada.vim', version=704 + generator='shada.vim', version=version }}, {timestamp=0, type=1, value={generator='test'}} }, { -- cgit From d15317ece4d707af48bafe7cee1e5d8545f3a280 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 15 Jul 2017 16:15:47 +0200 Subject: health.vim: fix test --- test/functional/plugin/health_spec.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/functional/plugin') diff --git a/test/functional/plugin/health_spec.lua b/test/functional/plugin/health_spec.lua index 644cd46092..3739540b09 100644 --- a/test/functional/plugin/health_spec.lua +++ b/test/functional/plugin/health_spec.lua @@ -70,7 +70,7 @@ describe('health.vim', function() health#broken#check ======================================================================== - ERROR: Failed to run healthcheck for "broken" plugin. Exception: - function health#check[20]..health#broken#check, line 1 + function health#check[21]..health#broken#check, line 1 caused an error ]]) end) -- cgit From c4ab110e04e0f447b836e0d613690b24b02f5c24 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 15 Oct 2017 11:56:02 +0200 Subject: health.vim: fix highlighting `:syntax keyword` is affected by 'iskeyword'. When we aligned 'iskeyword' to that of filetype=help, colon (:) is now included. Simplest way to deal with this is to include colon (:) in the `:syntax keyword` directive. Also: - change "SUGGESTIONS" mouthful to "ADVICE" - change "SUCCESS" to "OK" --- test/functional/plugin/health_spec.lua | 43 +++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 6 deletions(-) (limited to 'test/functional/plugin') diff --git a/test/functional/plugin/health_spec.lua b/test/functional/plugin/health_spec.lua index 3739540b09..8646ec98bf 100644 --- a/test/functional/plugin/health_spec.lua +++ b/test/functional/plugin/health_spec.lua @@ -1,4 +1,5 @@ local helpers = require('test.functional.helpers')(after_each) +local Screen = require('test.functional.ui.screen') local plugin_helpers = require('test.functional.plugin.helpers') local command = helpers.command @@ -30,13 +31,13 @@ describe('health.vim', function() ## Check Bar - - SUCCESS: Bar status - - SUCCESS: Other Bar status + - OK: Bar status + - OK: Other Bar status - WARNING: Zub ## Baz - WARNING: Zim - - SUGGESTIONS: + - ADVICE: - suggestion 1 - suggestion 2]]), result) @@ -51,15 +52,15 @@ describe('health.vim', function() health#success1#check ======================================================================== ## report 1 - - SUCCESS: everything is fine + - OK: everything is fine ## report 2 - - SUCCESS: nothing to see here + - OK: nothing to see here health#success2#check ======================================================================== ## another 1 - - SUCCESS: ok + - OK: ok ]]) end) @@ -75,6 +76,36 @@ describe('health.vim', function() ]]) end) + it("highlights OK, ERROR", function() + local screen = Screen.new(72, 10) + screen:attach() + screen:set_default_attr_ids({ + Ok = { foreground = Screen.colors.Grey3, background = 6291200 }, + Error = { foreground = Screen.colors.Grey100, background = Screen.colors.Red }, + }) + screen:set_default_attr_ignore({ + Heading = { bold=true, foreground=Screen.colors.Magenta }, + Heading2 = { foreground = Screen.colors.SlateBlue }, + Bar = { foreground=Screen.colors.Purple }, + Bullet = { bold=true, foreground=Screen.colors.Brown }, + }) + command("CheckHealth foo success1") + command("1tabclose") + command("set laststatus=0") + screen:expect([[ + ^ | + health#foo#check | + ========================================================================| + - {Error:ERROR:} No healthcheck found for "foo" plugin. | + | + health#success1#check | + ========================================================================| + ## report 1 | + - {Ok:OK:} everything is fine | + | + ]]) + end) + it("gracefully handles invalid healthcheck", function() command("CheckHealth non_existent_healthcheck") helpers.expect([[ -- cgit From 5baeb4a49c061472a125f98af798c522d8504fbe Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 15 Oct 2017 18:29:53 +0200 Subject: ex-cmds: :checkhealth Built-in `:checkhealth` checks for valid $VIMRUNTIME by attempting to autoload `health#check()`. closes #2977 closes #3159 --- test/functional/plugin/health_spec.lua | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'test/functional/plugin') diff --git a/test/functional/plugin/health_spec.lua b/test/functional/plugin/health_spec.lua index 8646ec98bf..a85a3ce495 100644 --- a/test/functional/plugin/health_spec.lua +++ b/test/functional/plugin/health_spec.lua @@ -2,7 +2,29 @@ local helpers = require('test.functional.helpers')(after_each) local Screen = require('test.functional.ui.screen') local plugin_helpers = require('test.functional.plugin.helpers') +local clear = helpers.clear local command = helpers.command +local eq = helpers.eq + +describe(':checkhealth', function() + it("detects invalid $VIMRUNTIME", function() + clear({ + env={ VIMRUNTIME='bogus', }, + }) + local status, err = pcall(command, 'checkhealth') + eq(false, status) + eq('Invalid $VIMRUNTIME: bogus', string.match(err, 'Invalid.*')) + end) + it("detects invalid $VIM", function() + clear({ + env={ VIM='bogus', }, + }) + local status, err = pcall(command, 'checkhealth') + eq(false, status) + -- Invalid $VIM causes $VIMRUNTIME to be broken. + eq('Invalid $VIMRUNTIME: bogus', string.match(err, 'Invalid.*')) + end) +end) describe('health.vim', function() before_each(function() @@ -14,7 +36,7 @@ describe('health.vim', function() command("set runtimepath+=test/functional/fixtures") end) - it("reports", function() + it("health#report_*()", function() helpers.source([[ let g:health_report = execute([ \ "call health#report_start('Check Bar')", @@ -44,7 +66,7 @@ describe('health.vim', function() end) - describe(":CheckHealth", function() + describe(":checkhealth", function() it("concatenates multiple reports", function() command("CheckHealth success1 success2") helpers.expect([[ -- cgit From d214df4e9b23b5f2d9f7e6c78624881a7d298cdb Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 15 Oct 2017 20:31:12 +0200 Subject: doc: replace ":CheckHealth" with ":checkhealth" --- test/functional/plugin/health_spec.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test/functional/plugin') diff --git a/test/functional/plugin/health_spec.lua b/test/functional/plugin/health_spec.lua index a85a3ce495..a91c0b401b 100644 --- a/test/functional/plugin/health_spec.lua +++ b/test/functional/plugin/health_spec.lua @@ -68,7 +68,7 @@ describe('health.vim', function() describe(":checkhealth", function() it("concatenates multiple reports", function() - command("CheckHealth success1 success2") + command("checkhealth success1 success2") helpers.expect([[ health#success1#check @@ -87,7 +87,7 @@ describe('health.vim', function() end) it("gracefully handles broken healthcheck", function() - command("CheckHealth broken") + command("checkhealth broken") helpers.expect([[ health#broken#check @@ -111,7 +111,7 @@ describe('health.vim', function() Bar = { foreground=Screen.colors.Purple }, Bullet = { bold=true, foreground=Screen.colors.Brown }, }) - command("CheckHealth foo success1") + command("checkhealth foo success1") command("1tabclose") command("set laststatus=0") screen:expect([[ @@ -129,7 +129,7 @@ describe('health.vim', function() end) it("gracefully handles invalid healthcheck", function() - command("CheckHealth non_existent_healthcheck") + command("checkhealth non_existent_healthcheck") helpers.expect([[ health#non_existent_healthcheck#check -- cgit From 3bcee71cc8ef782fc89de7d72cb784cfb6d984d3 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Tue, 17 Oct 2017 00:10:52 +0200 Subject: :checkhealth : validate $VIM --- test/functional/plugin/health_spec.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'test/functional/plugin') diff --git a/test/functional/plugin/health_spec.lua b/test/functional/plugin/health_spec.lua index a91c0b401b..b5374210e6 100644 --- a/test/functional/plugin/health_spec.lua +++ b/test/functional/plugin/health_spec.lua @@ -3,6 +3,7 @@ local Screen = require('test.functional.ui.screen') local plugin_helpers = require('test.functional.plugin.helpers') local clear = helpers.clear +local curbuf_contents = helpers.curbuf_contents local command = helpers.command local eq = helpers.eq @@ -16,13 +17,12 @@ describe(':checkhealth', function() eq('Invalid $VIMRUNTIME: bogus', string.match(err, 'Invalid.*')) end) it("detects invalid $VIM", function() - clear({ - env={ VIM='bogus', }, - }) - local status, err = pcall(command, 'checkhealth') - eq(false, status) - -- Invalid $VIM causes $VIMRUNTIME to be broken. - eq('Invalid $VIMRUNTIME: bogus', string.match(err, 'Invalid.*')) + clear() + -- Do this after startup, otherwise it just breaks $VIMRUNTIME. + command("let $VIM='zub'") + command("checkhealth nvim") + eq("ERROR: $VIM is invalid: zub", + string.match(curbuf_contents(), "ERROR: $VIM .* zub")) end) end) -- cgit From f5d4da0144c97ba13f530ea7dbd50f7b9768cb34 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Fri, 10 Nov 2017 22:37:54 +0100 Subject: :checkhealth : validate 'runtimepath' (#7526) --- test/functional/plugin/health_spec.lua | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test/functional/plugin') diff --git a/test/functional/plugin/health_spec.lua b/test/functional/plugin/health_spec.lua index b5374210e6..8ee0f258d0 100644 --- a/test/functional/plugin/health_spec.lua +++ b/test/functional/plugin/health_spec.lua @@ -16,6 +16,13 @@ describe(':checkhealth', function() eq(false, status) eq('Invalid $VIMRUNTIME: bogus', string.match(err, 'Invalid.*')) end) + it("detects invalid 'runtimepath'", function() + clear() + command('set runtimepath=bogus') + local status, err = pcall(command, 'checkhealth') + eq(false, status) + eq("Invalid 'runtimepath'", string.match(err, 'Invalid.*')) + end) it("detects invalid $VIM", function() clear() -- Do this after startup, otherwise it just breaks $VIMRUNTIME. -- cgit From 134c0f0bdb50b16d443b103fc1a81c9ae5c7c017 Mon Sep 17 00:00:00 2001 From: Gabriel Holodak Date: Fri, 1 Dec 2017 01:06:35 -0500 Subject: Add functional tests for man highlighting --- test/functional/plugin/man_spec.lua | 181 ++++++++++++++++++++++++++++++++++++ 1 file changed, 181 insertions(+) create mode 100644 test/functional/plugin/man_spec.lua (limited to 'test/functional/plugin') diff --git a/test/functional/plugin/man_spec.lua b/test/functional/plugin/man_spec.lua new file mode 100644 index 0000000000..53384a9d47 --- /dev/null +++ b/test/functional/plugin/man_spec.lua @@ -0,0 +1,181 @@ +local helpers = require('test.functional.helpers')(after_each) +local plugin_helpers = require('test.functional.plugin.helpers') + +local Screen = require('test.functional.ui.screen') + +local buffer, command, eval = helpers.buffer, helpers.command, helpers.eval + +before_each(function() + plugin_helpers.reset() + helpers.clear() + command('syntax on') + command('set filetype=man') +end) + +describe('In autoload/man.vim', function() + describe('function man#highlight_formatted_text', function() + local screen + + before_each(function() + command('syntax off') -- Ignore syntax groups + screen = Screen.new(52, 5) + screen:attach() + end) + + after_each(function() + screen:detach() + end) + + local function expect(string) + screen:expect(string, + { + b = { bold = true }, + i = { italic = true }, + u = { underline = true }, + bi = { bold = true, italic = true }, + biu = { bold = true, italic = true, underline = true }, + }, + {{ bold = true, foreground = Screen.colors.Blue }}) + end + + local function expect_without_highlights(string) + screen:expect(string, nil, true) + end + + local function insert_lines(...) + buffer('set_lines', 0, 0, 1, false, { ... }) + end + + it('clears backspaces from text', function() + insert_lines( + "this i\bis\bs a\ba test", + "with _\bo_\bv_\be_\br_\bs_\bt_\br_\bu_\bc_\bk text" + ) + + expect_without_highlights([[ + ^this i^His^Hs a^Ha test | + with _^Ho_^Hv_^He_^Hr_^Hs_^Ht_^Hr_^Hu_^Hc_^Hk text | + ~ | + ~ | + | + ]]) + + eval('man#highlight_formatted_text()') + + expect_without_highlights([[ + ^this is a test | + with overstruck text | + ~ | + ~ | + | + ]]) + end) + + it('clears escape sequences from text', function() + insert_lines( + "this \027[1mis \027[3ma \027[4mtest\027[0m", + "\027[4mwith\027[24m \027[4mescaped\027[24m \027[4mtext\027[24m" + ) + + expect_without_highlights([[ + ^this ^[[1mis ^[[3ma ^[[4mtest^[[0m | + ^[[4mwith^[[24m ^[[4mescaped^[[24m ^[[4mtext^[[24m | + ~ | + ~ | + | + ]]) + + eval('man#highlight_formatted_text()') + + expect_without_highlights([[ + ^this is a test | + with escaped text | + ~ | + ~ | + | + ]]) + end) + + it('highlights overstruck text', function() + insert_lines( + "this i\bis\bs a\ba test", + "with _\bo_\bv_\be_\br_\bs_\bt_\br_\bu_\bc_\bk text" + ) + eval('man#highlight_formatted_text()') + + expect([[ + ^this {b:is} {b:a} test | + with {u:overstruck} text | + ~ | + ~ | + | + ]]) + end) + + it('highlights escape sequences in text', function() + insert_lines( + "this \027[1mis \027[3ma \027[4mtest\027[0m", + "\027[4mwith\027[24m \027[4mescaped\027[24m \027[4mtext\027[24m" + ) + eval('man#highlight_formatted_text()') + + expect([[ + ^this {b:is }{bi:a }{biu:test} | + {u:with} {u:escaped} {u:text} | + ~ | + ~ | + | + ]]) + end) + + it('highlights multibyte text', function() + insert_lines( + "this i\bis\bs あ\bあ test", + "with _\bö_\bv_\be_\br_\bs_\bt_\br_\bu_\bc_\bk te\027[3mxt¶\027[0m" + ) + eval('man#highlight_formatted_text()') + + expect([[ + ^this {b:is} {b:あ} test | + with {u:överstruck} te{i:xt¶} | + ~ | + ~ | + | + ]]) + end) + + it('highlights underscores based on context', function() + insert_lines( + "_\b_b\bbe\beg\bgi\bin\bns\bs", + "m\bmi\bid\bd_\b_d\bdl\ble\be", + "_\bm_\bi_\bd_\b__\bd_\bl_\be" + ) + eval('man#highlight_formatted_text()') + + expect([[ + {b:^_begins} | + {b:mid_dle} | + {u:mid_dle} | + ~ | + | + ]]) + end) + + it('highlights various bullet formats', function() + insert_lines( + "· ·\b·", + "+\bo", + "+\b+\bo\bo double" + ) + eval('man#highlight_formatted_text()') + + expect([[ + ^· {b:·} | + {b:·} | + {b:·} double | + ~ | + | + ]]) + end) + end) +end) -- cgit From eb44519b5debf740f692bb4ea19ad83b29749484 Mon Sep 17 00:00:00 2001 From: Gabriel Holodak Date: Sun, 24 Dec 2017 12:16:58 -0500 Subject: Address PR comments --- test/functional/plugin/man_spec.lua | 148 +++++++++++++----------------------- 1 file changed, 51 insertions(+), 97 deletions(-) (limited to 'test/functional/plugin') diff --git a/test/functional/plugin/man_spec.lua b/test/functional/plugin/man_spec.lua index 53384a9d47..479fd6e7a5 100644 --- a/test/functional/plugin/man_spec.lua +++ b/test/functional/plugin/man_spec.lua @@ -3,7 +3,7 @@ local plugin_helpers = require('test.functional.plugin.helpers') local Screen = require('test.functional.ui.screen') -local buffer, command, eval = helpers.buffer, helpers.command, helpers.eval +local command, eval, rawfeed = helpers.command, helpers.eval, helpers.rawfeed before_each(function() plugin_helpers.reset() @@ -19,107 +19,64 @@ describe('In autoload/man.vim', function() before_each(function() command('syntax off') -- Ignore syntax groups screen = Screen.new(52, 5) - screen:attach() - end) - - after_each(function() - screen:detach() - end) - - local function expect(string) - screen:expect(string, - { + screen:set_default_attr_ids({ b = { bold = true }, i = { italic = true }, u = { underline = true }, bi = { bold = true, italic = true }, biu = { bold = true, italic = true, underline = true }, - }, - {{ bold = true, foreground = Screen.colors.Blue }}) - end - - local function expect_without_highlights(string) - screen:expect(string, nil, true) - end - - local function insert_lines(...) - buffer('set_lines', 0, 0, 1, false, { ... }) - end - - it('clears backspaces from text', function() - insert_lines( - "this i\bis\bs a\ba test", - "with _\bo_\bv_\be_\br_\bs_\bt_\br_\bu_\bc_\bk text" - ) - - expect_without_highlights([[ - ^this i^His^Hs a^Ha test | - with _^Ho_^Hv_^He_^Hr_^Hs_^Ht_^Hr_^Hu_^Hc_^Hk text | - ~ | - ~ | - | - ]]) - - eval('man#highlight_formatted_text()') + }) + screen:set_default_attr_ignore({ + { foreground = Screen.colors.Blue }, -- control chars + { bold = true, foreground = Screen.colors.Blue } -- empty line '~'s + }) + screen:attach() + end) - expect_without_highlights([[ - ^this is a test | - with overstruck text | - ~ | - ~ | - | - ]]) + after_each(function() + screen:detach() end) - it('clears escape sequences from text', function() - insert_lines( - "this \027[1mis \027[3ma \027[4mtest\027[0m", - "\027[4mwith\027[24m \027[4mescaped\027[24m \027[4mtext\027[24m" - ) + it('clears backspaces from text and adds highlights', function() + rawfeed([[ + ithis iiss aa test + with _o_v_e_r_s_t_r_u_c_k text]]) - expect_without_highlights([[ - ^this ^[[1mis ^[[3ma ^[[4mtest^[[0m | - ^[[4mwith^[[24m ^[[4mescaped^[[24m ^[[4mtext^[[24m | + screen:expect([[ + this i^His^Hs a^Ha test | + with _^Ho_^Hv_^He_^Hr_^Hs_^Ht_^Hr_^Hu_^Hc_^Hk tex^t | ~ | ~ | | ]]) - eval('man#highlight_formatted_text()') + eval('man#init_pager()') - expect_without_highlights([[ - ^this is a test | - with escaped text | + screen:expect([[ + ^this {b:is} {b:a} test | + with {u:overstruck} text | ~ | ~ | | ]]) end) - it('highlights overstruck text', function() - insert_lines( - "this i\bis\bs a\ba test", - "with _\bo_\bv_\be_\br_\bs_\bt_\br_\bu_\bc_\bk text" - ) - eval('man#highlight_formatted_text()') + it('clears escape sequences from text and adds highlights', function() + rawfeed([[ + ithis [1mis [3ma [4mtest[0m + [4mwith[24m [4mescaped[24m [4mtext[24m]]) - expect([[ - ^this {b:is} {b:a} test | - with {u:overstruck} text | + screen:expect([[ + this ^[[1mis ^[[3ma ^[[4mtest^[[0m | + ^[[4mwith^[[24m ^[[4mescaped^[[24m ^[[4mtext^[[24^m | ~ | ~ | | ]]) - end) - it('highlights escape sequences in text', function() - insert_lines( - "this \027[1mis \027[3ma \027[4mtest\027[0m", - "\027[4mwith\027[24m \027[4mescaped\027[24m \027[4mtext\027[24m" - ) - eval('man#highlight_formatted_text()') + eval('man#init_pager()') - expect([[ + screen:expect([[ ^this {b:is }{bi:a }{biu:test} | {u:with} {u:escaped} {u:text} | ~ | @@ -129,15 +86,14 @@ describe('In autoload/man.vim', function() end) it('highlights multibyte text', function() - insert_lines( - "this i\bis\bs あ\bあ test", - "with _\bö_\bv_\be_\br_\bs_\bt_\br_\bu_\bc_\bk te\027[3mxt¶\027[0m" - ) - eval('man#highlight_formatted_text()') + rawfeed([[ + ithis iiss ああ test + with _ö_v_e_r_s_t_r_u_̃_c_k te[3mxt¶[0m]]) + eval('man#init_pager()') - expect([[ + screen:expect([[ ^this {b:is} {b:あ} test | - with {u:överstruck} te{i:xt¶} | + with {u:överstrũck} te{i:xt¶} | ~ | ~ | | @@ -145,14 +101,13 @@ describe('In autoload/man.vim', function() end) it('highlights underscores based on context', function() - insert_lines( - "_\b_b\bbe\beg\bgi\bin\bns\bs", - "m\bmi\bid\bd_\b_d\bdl\ble\be", - "_\bm_\bi_\bd_\b__\bd_\bl_\be" - ) - eval('man#highlight_formatted_text()') - - expect([[ + rawfeed([[ + i__bbeeggiinnss + mmiidd__ddllee + _m_i_d___d_l_e]]) + eval('man#init_pager()') + + screen:expect([[ {b:^_begins} | {b:mid_dle} | {u:mid_dle} | @@ -162,14 +117,13 @@ describe('In autoload/man.vim', function() end) it('highlights various bullet formats', function() - insert_lines( - "· ·\b·", - "+\bo", - "+\b+\bo\bo double" - ) - eval('man#highlight_formatted_text()') - - expect([[ + rawfeed([[ + i· ·· + +o + ++oo double]]) + eval('man#init_pager()') + + screen:expect([[ ^· {b:·} | {b:·} | {b:·} double | -- cgit From 7311fb7cadff49422a15d3a40d7014000c8f4385 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Thu, 19 Oct 2017 17:26:03 -0400 Subject: win: enable more functional tests - plugin/shada_spec.lua: Use \r\n as Windows EOL for tests on BufWriteCmd, FileWriteCmd, FileAppendCmd. Alternative is 'set fileformat=unix'. --- test/functional/plugin/shada_spec.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'test/functional/plugin') diff --git a/test/functional/plugin/shada_spec.lua b/test/functional/plugin/shada_spec.lua index dbc78e63f0..57891a8229 100644 --- a/test/functional/plugin/shada_spec.lua +++ b/test/functional/plugin/shada_spec.lua @@ -43,8 +43,6 @@ local wshada, _, fname = get_shada_rw('Xtest-functional-plugin-shada.shada') local wshada_tmp, _, fname_tmp = get_shada_rw('Xtest-functional-plugin-shada.shada.tmp.f') -if helpers.pending_win32(pending) then return end - describe('In autoload/shada.vim', function() local epoch = os.date('%Y-%m-%dT%H:%M:%S', 0) before_each(function() @@ -2140,6 +2138,7 @@ end) describe('In plugin/shada.vim', function() local epoch = os.date('%Y-%m-%dT%H:%M:%S', 0) + local eol = helpers.iswin() and '\r\n' or '\n' before_each(function() reset() os.remove(fname) @@ -2279,7 +2278,7 @@ describe('In plugin/shada.vim', function() ' + f file name ["foo"]', ' + l line number 2', ' + c column -200', - }, '\n') .. '\n', io.open(fname .. '.tst'):read('*a')) + }, eol) .. eol, io.open(fname .. '.tst'):read('*a')) shada_eq({{ timestamp=0, type=8, @@ -2303,6 +2302,7 @@ describe('In plugin/shada.vim', function() describe('event FileWriteCmd', function() it('works', function() + if helpers.pending_win32(pending) then return end nvim('set_var', 'shada#add_own_header', 0) curbuf('set_lines', 0, 1, true, { 'Jump with timestamp ' .. epoch .. ':', @@ -2326,7 +2326,7 @@ describe('In plugin/shada.vim', function() 'Jump with timestamp ' .. epoch .. ':', ' % Key________ Description Value', ' + n name \'A\'', - }, '\n') .. '\n', io.open(fname .. '.tst'):read('*a')) + }, eol) .. eol, io.open(fname .. '.tst'):read('*a')) shada_eq({{ timestamp=0, type=8, @@ -2383,7 +2383,7 @@ describe('In plugin/shada.vim', function() ' + f file name ["foo"]', ' + l line number 2', ' + c column -200', - }, '\n') .. '\n', io.open(fname .. '.tst'):read('*a')) + }, eol) .. eol, io.open(fname .. '.tst'):read('*a')) shada_eq({{ timestamp=0, type=8, -- cgit From 72a7a884b4a5f1642726403a3cc997d82bb616f4 Mon Sep 17 00:00:00 2001 From: Marco Hinz Date: Thu, 18 Jan 2018 15:54:25 +0100 Subject: tests: :checkhealth completion --- test/functional/plugin/health_spec.lua | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test/functional/plugin') diff --git a/test/functional/plugin/health_spec.lua b/test/functional/plugin/health_spec.lua index 8ee0f258d0..f2d5e433db 100644 --- a/test/functional/plugin/health_spec.lua +++ b/test/functional/plugin/health_spec.lua @@ -6,6 +6,7 @@ local clear = helpers.clear local curbuf_contents = helpers.curbuf_contents local command = helpers.command local eq = helpers.eq +local getcompletion = helpers.funcs.getcompletion describe(':checkhealth', function() it("detects invalid $VIMRUNTIME", function() @@ -31,6 +32,11 @@ describe(':checkhealth', function() eq("ERROR: $VIM is invalid: zub", string.match(curbuf_contents(), "ERROR: $VIM .* zub")) end) + it('completions can be listed via getcompletion()', function() + clear() + eq('nvim', getcompletion('nvim', 'checkhealth')[1]) + eq('provider', getcompletion('prov', 'checkhealth')[1]) + end) end) describe('health.vim', function() -- cgit From f8010ea3eca77961312afeb96234678447ce17e4 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Thu, 1 Feb 2018 03:12:37 +0100 Subject: test: robust cleanup, unique filenames #7950 (#7950) Use unique filenames to avoid test conflicts. Use read_file() instead of io.popen(), to ensures the file is closed. Use helpers.rmdir(), it is far more robust than lfs. closes #7911 --- test/functional/plugin/shada_spec.lua | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'test/functional/plugin') diff --git a/test/functional/plugin/shada_spec.lua b/test/functional/plugin/shada_spec.lua index 5a064a759f..5a5b4df1ef 100644 --- a/test/functional/plugin/shada_spec.lua +++ b/test/functional/plugin/shada_spec.lua @@ -3,6 +3,7 @@ local eq, nvim_eval, nvim_command, nvim, exc_exec, funcs, nvim_feed, curbuf = helpers.eq, helpers.eval, helpers.command, helpers.nvim, helpers.exc_exec, helpers.funcs, helpers.feed, helpers.curbuf local neq = helpers.neq +local read_file = helpers.read_file local mpack = require('mpack') @@ -2152,9 +2153,7 @@ describe('plugin/shada.vim', function() end) local shada_eq = function(expected, fname_) - local fd = io.open(fname_) - local mpack_result = fd:read('*a') - fd:close() + local mpack_result = read_file(fname_) mpack_eq(expected, mpack_result) end @@ -2278,7 +2277,7 @@ describe('plugin/shada.vim', function() ' + f file name ["foo"]', ' + l line number 2', ' + c column -200', - }, eol) .. eol, io.open(fname .. '.tst'):read('*a')) + }, eol) .. eol, read_file(fname .. '.tst')) shada_eq({{ timestamp=0, type=8, @@ -2326,7 +2325,7 @@ describe('plugin/shada.vim', function() 'Jump with timestamp ' .. epoch .. ':', ' % Key________ Description Value', ' + n name \'A\'', - }, eol) .. eol, io.open(fname .. '.tst'):read('*a')) + }, eol) .. eol, read_file(fname .. '.tst')) shada_eq({{ timestamp=0, type=8, @@ -2383,7 +2382,7 @@ describe('plugin/shada.vim', function() ' + f file name ["foo"]', ' + l line number 2', ' + c column -200', - }, eol) .. eol, io.open(fname .. '.tst'):read('*a')) + }, eol) .. eol, read_file(fname .. '.tst')) shada_eq({{ timestamp=0, type=8, -- cgit From e243dbdc328b53926009153bd7fca32ebfc1abb2 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Thu, 1 Feb 2018 14:30:31 -0500 Subject: test: man_spec: Fix use of nested [[ quoting Lua (not LuaJIT) complains about the "^[[" strings inside the expect, since it sees them as nested quotes. Change the quoting to [=[ ]=] to avoid the issue. --- test/functional/plugin/man_spec.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/functional/plugin') diff --git a/test/functional/plugin/man_spec.lua b/test/functional/plugin/man_spec.lua index dc189b8f8e..e5da7932a5 100644 --- a/test/functional/plugin/man_spec.lua +++ b/test/functional/plugin/man_spec.lua @@ -66,13 +66,13 @@ describe(':Man', function() ithis [1mis [3ma [4mtest[0m [4mwith[24m [4mescaped[24m [4mtext[24m]]) - screen:expect([[ + screen:expect([=[ this ^[[1mis ^[[3ma ^[[4mtest^[[0m | ^[[4mwith^[[24m ^[[4mescaped^[[24m ^[[4mtext^[[24^m | ~ | ~ | | - ]]) + ]=]) eval('man#init_pager()') -- cgit