diff options
Diffstat (limited to 'test/unit')
-rw-r--r-- | test/unit/os/env_spec.lua | 17 | ||||
-rw-r--r-- | test/unit/path_spec.lua | 7 |
2 files changed, 20 insertions, 4 deletions
diff --git a/test/unit/os/env_spec.lua b/test/unit/os/env_spec.lua index 5896f5ddd4..9d936c2564 100644 --- a/test/unit/os/env_spec.lua +++ b/test/unit/os/env_spec.lua @@ -3,6 +3,7 @@ local helpers = require('test.unit.helpers') local cimport = helpers.cimport local internalize = helpers.internalize local eq = helpers.eq +local neq = helpers.neq local ffi = helpers.ffi local lib = helpers.lib local cstr = helpers.cstr @@ -21,6 +22,10 @@ describe('env function', function() return env.os_setenv((to_cstr(name)), (to_cstr(value)), override) end + function os_unsetenv(name, value, override) + return env.os_unsetenv((to_cstr(name))) + end + function os_getenv(name) local rval = env.os_getenv((to_cstr(name))) if rval ~= NULL then @@ -68,6 +73,18 @@ describe('env function', function() end) end) + describe('os_unsetenv', function() + it('unsets environment variable', function() + local name = 'TEST_UNSETENV' + local value = 'TESTVALUE' + os_setenv(name, value, 1) + os_unsetenv(name) + neq(os_getenv(name), value) + -- Depending on the platform the var might be unset or set as '' + assert.True(os_getenv(name) == nil or os_getenv(name) == '') + end) + end) + describe('os_getenvname_at_index', function() it('returns names of environment variables', function() local test_name = 'NEOVIM_UNIT_TEST_GETENVNAME_AT_INDEX_1N' diff --git a/test/unit/path_spec.lua b/test/unit/path_spec.lua index 13546a6183..261d797624 100644 --- a/test/unit/path_spec.lua +++ b/test/unit/path_spec.lua @@ -425,19 +425,18 @@ describe('more path function', function() return ffi.string(c_file) end + before_each(function() lfs.mkdir('CamelCase') end) + after_each(function() lfs.rmdir('CamelCase') end) + if ffi.os == 'Windows' or ffi.os == 'OSX' then it('Corrects the case of file names in Mac and Windows', function() - lfs.mkdir('CamelCase') eq('CamelCase', fix_case('camelcase')) eq('CamelCase', fix_case('cAMELcASE')) - lfs.rmdir('CamelCase') end) else it('does nothing on Linux', function() - lfs.mkdir('CamelCase') eq('camelcase', fix_case('camelcase')) eq('cAMELcASE', fix_case('cAMELcASE')) - lfs.mkdir('CamelCase') end) end end) |