Mercurial > vim
view src/testdir/test_environ.vim @ 16920:8d91579414b8 v8.1.1461
patch 8.1.1461: tests do not run or are not reliable on some systems
commit https://github.com/vim/vim/commit/ddd3308782e931a2c390d692cb23c40d8169bd6f
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Jun 3 23:07:25 2019 +0200
patch 8.1.1461: tests do not run or are not reliable on some systems
Problem: Tests do not run or are not reliable on some systems.
Solution: Use "findstr" instead of "grep" on MS-Windows. Clear
PROMPT_COMMAND in the terminal test. Delete temp file. Wait for
output after executing a debug command. (Yegappan Lakshmanan,
closes #4479)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 03 Jun 2019 23:15:04 +0200 |
parents | 1e0a5f09fdf1 |
children | 4ba323df874a |
line wrap: on
line source
scriptencoding utf-8 func Test_environ() unlet! $TESTENV call assert_equal(0, has_key(environ(), 'TESTENV')) let $TESTENV = 'foo' call assert_equal(1, has_key(environ(), 'TESTENV')) let $TESTENV = 'こんにちわ' call assert_equal('こんにちわ', environ()['TESTENV']) endfunc func Test_getenv() unlet! $TESTENV call assert_equal(v:null, getenv('TESTENV')) let $TESTENV = 'foo' call assert_equal('foo', getenv('TESTENV')) endfunc func Test_setenv() unlet! $TESTENV call setenv('TEST ENV', 'foo') call assert_equal('foo', getenv('TEST ENV')) call setenv('TEST ENV', v:null) call assert_equal(v:null, getenv('TEST ENV')) endfunc func Test_external_env() call setenv('FOO', 'HelloWorld') if has('win32') let result = system('echo %FOO%') else let result = system('echo $FOO') endif let result = substitute(result, '[ \r\n]', '', 'g') call assert_equal('HelloWorld', result) call setenv('FOO', v:null) if has('win32') let result = system('set | findstr ^FOO=') else let result = system('env | grep ^FOO=') endif call assert_equal('', result) endfunc