diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/functional/normal/K_spec.lua | 39 | ||||
| -rw-r--r-- | test/functional/provider/python3_spec.lua | 18 | ||||
| -rw-r--r-- | test/functional/provider/python_spec.lua | 18 |
3 files changed, 57 insertions, 18 deletions
diff --git a/test/functional/normal/K_spec.lua b/test/functional/normal/K_spec.lua new file mode 100644 index 0000000000..dbda6dcb93 --- /dev/null +++ b/test/functional/normal/K_spec.lua @@ -0,0 +1,39 @@ +local helpers = require('test.functional.helpers') +local execute, eq, clear, eval, feed, ok = + helpers.execute, helpers.eq, helpers.clear, helpers.eval, + helpers.feed, helpers.ok + +describe('K', function() + local test_file = 'K_spec_out' + before_each(function() + clear() + os.remove(test_file) + end) + after_each(function() + os.remove(test_file) + end) + + it("invokes colon-prefixed 'keywordprg' as Vim command", function() + helpers.source([[ + let @a='fnord' + set keywordprg=:put]]) + + -- K on the text "a" resolves to `:put a`. + feed('ia<ESC>K') + helpers.expect([[ + a + fnord]]) + end) + + it("invokes non-prefixed 'keywordprg' as shell command", function() + helpers.source([[ + let @a='fnord' + set keywordprg=echo\ fnord\ >>]]) + + -- K on the text "K_spec_out" resolves to `!echo fnord >> K_spec_out`. + feed('i'..test_file..'<ESC>K') + feed('<CR>') -- Press ENTER + eq({'fnord'}, eval("readfile('"..test_file.."')")) + end) + +end) diff --git a/test/functional/provider/python3_spec.lua b/test/functional/provider/python3_spec.lua index 5be5390370..5ecc1a0a91 100644 --- a/test/functional/provider/python3_spec.lua +++ b/test/functional/provider/python3_spec.lua @@ -1,19 +1,19 @@ +local helpers = require('test.functional.helpers') +local eval, command, feed = helpers.eval, helpers.command, helpers.feed +local eq, clear, insert = helpers.eq, helpers.clear, helpers.insert +local expect, write_file = helpers.expect, helpers.write_file + do - local proc = io.popen( - [[python3 -c 'import neovim, sys; sys.stdout.write("ok")' 2> /dev/null]]) - if proc:read() ~= 'ok' then + command('let [g:interp, g:errors] = provider#pythonx#Detect(3)') + local errors = eval('g:errors') + if errors ~= '' then pending( - 'python3 (or the python3 neovim module) is broken or missing', + 'Python 3 (or the Python 3 neovim module) is broken or missing:\n' .. errors, function() end) return end end -local helpers = require('test.functional.helpers') -local eval, command, feed = helpers.eval, helpers.command, helpers.feed -local eq, clear, insert = helpers.eq, helpers.clear, helpers.insert -local expect, write_file = helpers.expect, helpers.write_file - describe('python3 commands and functions', function() before_each(function() clear() diff --git a/test/functional/provider/python_spec.lua b/test/functional/provider/python_spec.lua index ec1a853546..f37c16a26a 100644 --- a/test/functional/provider/python_spec.lua +++ b/test/functional/provider/python_spec.lua @@ -1,19 +1,19 @@ +local helpers = require('test.functional.helpers') +local eval, command, feed = helpers.eval, helpers.command, helpers.feed +local eq, clear, insert = helpers.eq, helpers.clear, helpers.insert +local expect, write_file = helpers.expect, helpers.write_file + do - local proc = io.popen( - [[python -c 'import neovim, sys; sys.stdout.write("ok")' 2> /dev/null]]) - if proc:read() ~= 'ok' then + command('let [g:interp, g:errors] = provider#pythonx#Detect(2)') + local errors = eval('g:errors') + if errors ~= '' then pending( - 'python (or the python neovim module) is broken or missing', + 'Python 2 (or the Python 2 neovim module) is broken or missing:\n' .. errors, function() end) return end end -local helpers = require('test.functional.helpers') -local eval, command, feed = helpers.eval, helpers.command, helpers.feed -local eq, clear, insert = helpers.eq, helpers.clear, helpers.insert -local expect, write_file = helpers.expect, helpers.write_file - describe('python commands and functions', function() before_each(function() clear() |