diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2017-05-10 15:04:49 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2018-02-07 09:25:51 +0100 |
commit | 352a51e8313d05c4701f468a79540a2410c77b23 (patch) | |
tree | 43f1c54f9c08c8f91c6568f7cccb27c6f4b55ae0 /test/functional/ui | |
parent | 538361955d123d9c93387f7597303c0ef59c6825 (diff) | |
download | rneovim-352a51e8313d05c4701f468a79540a2410c77b23.tar.gz rneovim-352a51e8313d05c4701f468a79540a2410c77b23.tar.bz2 rneovim-352a51e8313d05c4701f468a79540a2410c77b23.zip |
test: :! print binary data, control chars
closes #5442
closes #4142
ref #6618
ref #4376
ref #7844
ref #2958
ref #4338
Diffstat (limited to 'test/functional/ui')
-rw-r--r-- | test/functional/ui/output_spec.lua | 70 |
1 files changed, 68 insertions, 2 deletions
diff --git a/test/functional/ui/output_spec.lua b/test/functional/ui/output_spec.lua index da3f474e08..c42c0b26c6 100644 --- a/test/functional/ui/output_spec.lua +++ b/test/functional/ui/output_spec.lua @@ -1,9 +1,14 @@ +local Screen = require('test.functional.ui.screen') local session = require('test.functional.helpers')(after_each) local child_session = require('test.functional.terminal.helpers') - -if session.pending_win32(pending) then return end +local eq = session.eq +local eval = session.eval +local feed = session.feed +local iswin = session.iswin describe("shell command :!", function() + if session.pending_win32(pending) then return end + local screen before_each(function() session.clear() @@ -66,3 +71,64 @@ describe("shell command :!", function() ]]) end) end) + +describe("shell command :!", function() + before_each(function() + session.clear() + end) + + it("cat a binary file #4142", function() + feed(":exe 'silent !cat '.shellescape(v:progpath)<CR>") + eq(2, eval('1+1')) -- Still alive? + end) + + it([[display \x08 char #4142]], function() + feed(":silent !echo \08<CR>") + eq(2, eval('1+1')) -- Still alive? + end) + + it([[handles control codes]], function() + if iswin() then + pending('missing printf', function() end) + return + end + local screen = Screen.new(50, 4) + screen:attach() + -- Print TAB chars. #2958 + feed([[:!printf '1\t2\t3'<CR>]]) + screen:expect([[ + ~ | + :!printf '1\t2\t3' | + 1 2 3 | + Press ENTER or type command to continue^ | + ]]) + feed([[<CR>]]) + -- Print BELL control code. #4338 + feed([[:!printf '\x07\x07\x07\x07text'<CR>]]) + screen:expect([[ + ~ | + :!printf '\x07\x07\x07\x07text' | + ^G^G^G^Gtext | + Press ENTER or type command to continue^ | + ]]) + feed([[<CR>]]) + -- Print BS control code. + feed([[:echo system('printf ''\x08\n''')<CR>]]) + screen:expect([[ + ~ | + ^H | + | + Press ENTER or type command to continue^ | + ]]) + feed([[<CR>]]) + -- Print LF control code. + feed([[:!printf '\n'<CR>]]) + screen:expect([[ + :!printf '\n' | + | + | + Press ENTER or type command to continue^ | + ]]) + feed([[<CR>]]) + end) +end) |