diff options
author | ZyX <kp-pav@yandex.ru> | 2017-03-05 04:02:45 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-03-11 23:23:30 +0300 |
commit | 12b062b2c862fd436cff0df4ebb2e5ca22e75e19 (patch) | |
tree | 47cb394b68714d419728e7aca87b9bac909df96f /test/unit/tempfile_spec.lua | |
parent | 5898b42d82a5a4b594879f30d84611c98ce6bd54 (diff) | |
download | rneovim-12b062b2c862fd436cff0df4ebb2e5ca22e75e19.tar.gz rneovim-12b062b2c862fd436cff0df4ebb2e5ca22e75e19.tar.bz2 rneovim-12b062b2c862fd436cff0df4ebb2e5ca22e75e19.zip |
unittests: Run all unit tests in their own processes
Used
sed -r -i -e '/ helpers =/ s/$/\nlocal itp = helpers.gen_itp(it)/; s/^(\s*)it\(/\1itp(/' test/unit/**/*_spec.lua
to alter all tests. Locally they all run fine now.
Reasoning:
1. General: state from one test should not affect other tests.
2. Local: travis build is failing with something which may be an output of
garbage collector. This should prevent state of the garbage collector from
interferring as well.
Diffstat (limited to 'test/unit/tempfile_spec.lua')
-rw-r--r-- | test/unit/tempfile_spec.lua | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/test/unit/tempfile_spec.lua b/test/unit/tempfile_spec.lua index cf0d78b7a7..f435c950e9 100644 --- a/test/unit/tempfile_spec.lua +++ b/test/unit/tempfile_spec.lua @@ -1,5 +1,6 @@ local lfs = require 'lfs' local helpers = require 'test.unit.helpers' +local itp = helpers.gen_itp(it) local os = helpers.cimport './src/nvim/os/os.h' local tempfile = helpers.cimport './src/nvim/fileio.h' @@ -17,7 +18,7 @@ describe('tempfile related functions', function() end describe('vim_gettempdir', function() - it('returns path to Neovim own temp directory', function() + itp('returns path to Neovim own temp directory', function() local dir = vim_gettempdir() assert.True(dir ~= nil and dir:len() > 0) -- os_file_is_writable returns 2 for a directory which we have rights @@ -28,7 +29,7 @@ describe('tempfile related functions', function() end end) - it('returns the same directory on each call', function() + itp('returns the same directory on each call', function() local dir1 = vim_gettempdir() local dir2 = vim_gettempdir() assert.equals(dir1, dir2) @@ -40,19 +41,19 @@ describe('tempfile related functions', function() return helpers.ffi.string(tempfile.vim_tempname()) end - it('generate name of non-existing file', function() + itp('generate name of non-existing file', function() local file = vim_tempname() assert.truthy(file) assert.False(os.os_path_exists(file)) end) - it('generate different names on each call', function() + itp('generate different names on each call', function() local fst = vim_tempname() local snd = vim_tempname() assert.not_equals(fst, snd) end) - it('generate file name in Neovim own temp directory', function() + itp('generate file name in Neovim own temp directory', function() local dir = vim_gettempdir() local file = vim_tempname() assert.truthy(file:find('^' .. dir .. '[^/]*$')) |