diff options
author | ZyX <kp-pav@yandex.ru> | 2017-03-19 16:09:48 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-03-19 16:09:48 +0300 |
commit | fdfa1ed578afd41a68f05c88dc419d88051b7240 (patch) | |
tree | 6eac36009c75cb33b211a48d7cc043c0df1a3b86 /test | |
parent | d2268d5ebbbd472c9c4f303404dc5640208d3b3b (diff) | |
download | rneovim-fdfa1ed578afd41a68f05c88dc419d88051b7240.tar.gz rneovim-fdfa1ed578afd41a68f05c88dc419d88051b7240.tar.bz2 rneovim-fdfa1ed578afd41a68f05c88dc419d88051b7240.zip |
main: Temporary fix assertion error
This variant uses `fdopen()` which is not standard, but it fixes problem on my
system. In next commit `scriptin` will use `FileDescriptor*` from os/fileio in
place of `FILE*`.
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/core/main_spec.lua | 48 | ||||
-rw-r--r-- | test/unit/os/fs_spec.lua | 16 |
2 files changed, 64 insertions, 0 deletions
diff --git a/test/functional/core/main_spec.lua b/test/functional/core/main_spec.lua index c3aeb30398..bad5d72142 100644 --- a/test/functional/core/main_spec.lua +++ b/test/functional/core/main_spec.lua @@ -1,7 +1,9 @@ local lfs = require('lfs') local helpers = require('test.functional.helpers')(after_each) +local Screen = require('test.functional.ui.screen') local eq = helpers.eq +local feed = helpers.feed local clear = helpers.clear local funcs = helpers.funcs local nvim_prog = helpers.nvim_prog @@ -53,5 +55,51 @@ describe('Command-line option', function() local attrs = lfs.attributes(fname) eq(#('100500\n'), attrs.size) end) + it('does not crash after reading from stdin in non-headless mode', function() + local screen = Screen.new(40, 8) + screen:attach() + eq(nil, lfs.attributes(fname)) + funcs.termopen({ + nvim_prog_abs(), '-u', 'NONE', '-i', 'NONE', + '--cmd', 'set noswapfile shortmess+=IFW fileformats=unix', + '-s', '-' + }) + screen:expect([[ + ^ | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {2:[No Name] 0,0-1 All}| + | + | + ]], { + [1] = {foreground = 4210943, special = Screen.colors.Grey0}, + [2] = {special = Screen.colors.Grey0, bold = true, reverse = true} + }) + feed('i:cq<CR><C-\\><C-n>') + screen:expect([[ + ^ | + [Process exited 1] | + | + | + | + | + | + | + ]]) + --[=[ Example of incorrect output: + screen:expect([[ + ^nvim: /var/tmp/portage/dev-libs/libuv-1.| + 10.2/work/libuv-1.10.2/src/unix/core.c:5| + 19: uv__close: Assertion `fd > STDERR_FI| + LENO' failed. | + | + [Process exited 6] | + | + | + ]]) + ]=] + end) end) end) diff --git a/test/unit/os/fs_spec.lua b/test/unit/os/fs_spec.lua index 860ebfdbcb..b03040260f 100644 --- a/test/unit/os/fs_spec.lua +++ b/test/unit/os/fs_spec.lua @@ -483,6 +483,22 @@ describe('fs function', function() end) end) + describe('os_dup', function() + itp('returns new file descriptor', function() + local dup0 = fs.os_dup(0) + local dup1 = fs.os_dup(1) + local dup2 = fs.os_dup(2) + local tbl = {[0]=true, [1]=true, [2]=true, + [tonumber(dup0)]=true, [tonumber(dup1)]=true, + [tonumber(dup2)]=true} + local i = 0 + for _, _ in pairs(tbl) do + i = i + 1 + end + eq(i, 6) -- All fds must be unique + end) + end) + describe('os_open', function() local new_file = 'test_new_file' local existing_file = 'unit-test-directory/test_existing.file' |