Commit Graph

224 Commits

Author SHA1 Message Date
Justin M. Keyes
53f11dcfc7
Merge #8218 'Fix errors reported by PVS'
closes #4983
2018-04-27 09:25:02 +02:00
ZyX
03c2844b53 functests: Fix testlint errors 2018-04-22 20:32:25 +03:00
ZyX
f8d574225b eval: Silence PVS/V547: E882 may be triggered
I failed to deduce why analyzer thinks E882 may not be triggered, though 
conditions for triggering it are strange: it would trigger E882 only in the 
single case “function returned non-number”. Cases “function thrown exception”, 
or “built-in sorter encountered error” will neither yield E882 nor stop 
sort()/uniq().

Note though that searching test code revealed that neither E702 nor E882 are not 
tested anywhere.
2018-04-15 18:45:12 +03:00
Jan Edmund Lazo
5abfa94ed2 test: win: use "start" to test backgrounded job (#8171) 2018-04-15 02:43:18 +02:00
Justin M. Keyes
704ba4151e server: init v:servername if $NVIM_LISTEN_ADDRESS is invalid
Before this change, if $NVIM_LISTEN_ADDRESS was invalid, v:servername
was left empty.
2018-04-11 02:41:05 +02:00
Justin M. Keyes
507bda1c95 server: introduce --listen, deprecate $NVIM_LISTEN_ADDRESS 2018-04-11 02:41:05 +02:00
Justin M. Keyes
9f598e5765 serverstop(): return FALSE for invalid address 2018-04-11 01:58:41 +02:00
Björn Linse
98e7112390 msg: do not scroll entire screen (#8088) 2018-03-31 11:12:27 +02:00
Jan Edmund Lazo
131aad953c win: defaults: 'shellcmdflag', 'shellxquote' #7343
closes #7698

Wrapping a command in double-quotes allows cmd.exe to safely dequote the
entire command as if the user entered the entire command in an
interactive prompt. This reduces the need to escape nested and uneven
double quotes.

The `/s` flag of cmd.exe makes the behaviour more reliable:

    :set shellcmdflag=/s\ /c

Before this patch, cmd.exe cannot use cygwin echo.exe (as opposed to
cmd.exe `echo` builtin) even if it is wrapped in double quotes.

Example:
:: internal echo
> cmd /s /c " echo foo\:bar" "
foo\:bar"

:: cygwin echo.exe
> cmd /s /c " "echo" foo\:bar" "
foo:bar
2018-03-24 22:05:53 +01:00
Jan Edmund Lazo
795da343bb test: win: emulate yes with for loop 2018-02-19 07:10:46 -05:00
Björn Linse
6e5cb0debd ui: refactor ui options 2018-02-13 20:48:51 +01:00
Jan Edmund Lazo
c03a847884 win: enable backtick_expansion and shell output tests 2018-02-10 22:28:12 +01:00
Justin M. Keyes
352a51e831 test: :! print binary data, control chars
closes #5442
closes #4142
ref #6618
ref #4376
ref #7844
ref #2958
ref #4338
2018-02-07 09:25:51 +01:00
Björn Linse
4e7d85e635 shell: update execute('!cmd') test to new behavior
And similarly nvim_command_output test
2018-02-06 20:16:38 +01:00
Justin M. Keyes
f8010ea3ec
test: robust cleanup, unique filenames #7950 (#7950)
Use unique filenames to avoid test conflicts.
Use read_file() instead of io.popen(), to ensures the file is closed.
Use helpers.rmdir(), it is far more robust than lfs.

closes #7911
2018-02-01 03:12:37 +01:00
Justin M. Keyes
648fed975e os_system(): do not set up input stream for empty string #7951
Test failure:
test/functional/eval/system_spec.lua: "works with an empty string"
E5677: Error writing input to shell-command: EPIPE

ref https://github.com/neovim/neovim/pull/6558#issuecomment-361061035
ref #6554
2018-02-01 02:28:54 +01:00
Mahmoud Al-Qudsi
5d2dd2ebe2 win: has("wsl") on Windows Subsystem for Linux #7330
Per CMAKE docs, CMAKE_HOST_SYSTEM_VERSION is the result of `uname -r`:
https://cmake.org/cmake/help/v3.4/variable/CMAKE_HOST_SYSTEM_VERSION.html?highlight=uname

    A numeric version string for the system. On systems that support
    uname, this variable is set to the output of uname -r. On other
    systems this is set to major-minor version numbers.

On Windows it is something like "6.1", so it won't match ".*-Microsoft".

Closes #7329
2018-01-30 21:12:49 +01:00
Jan Edmund Lazo
41b3c7850f test: use helpers.pathroot() to avoid a syscall 2018-01-29 00:05:35 -05:00
Jan Edmund Lazo
5a39d2d00e test: fnamemodify with :8 filename modifier 2018-01-28 13:58:54 -05:00
Jan Edmund Lazo
eb59dd6547 fixup: get network drive only, not entire path 2018-01-28 13:58:54 -05:00
Jan Edmund Lazo
534abe4aaf test: win: get current network drive via io.popen 2018-01-28 13:58:53 -05:00
Jan Edmund Lazo
a619c3fcf9 test: win: add tests for shellslash 2018-01-28 13:58:51 -05:00
Justin M. Keyes
afbdafffc2 test: fnamemodify() 2018-01-28 13:58:51 -05:00
George Zhao
499c9a1553 test/win: fix some environment assumptions #7912
fix #7909
fix #7910
2018-01-28 19:10:18 +01:00
James McCoy
3ff92ba1ee
eval: save_tv_as_string: Correctly handle an empty string
When tv_get_string_chk returns a non-NULL value, we have a valid string.
Propagating an error state (*len = -1, NULL return) for an empty string
is invalid.

Closes #6554
2018-01-23 17:56:50 -05:00
Justin M. Keyes
15119f943a test: system(): fix test
For the test to be valid it should actually send input.

ref #3529
ref #5241
2018-01-23 21:33:44 +01:00
Justin M. Keyes
60d6a8b13d Merge #7860 'fix get_buffer_lines' 2018-01-16 08:21:25 +01:00
James McCoy
514a51ef3e
get_buffer_lines: Return a string, when requested, on invalid input
Closes #7859
2018-01-15 22:55:15 -05:00
Justin M. Keyes
f8f7f9d5f5 vim-patch:8.0.0151,3,4 #7389
vim-patch:8.0.0151
Problem:    To pass buffer content to system() and systemlist() one has to
            first create a string or list.
Solution:   Allow passing a buffer number. (LemonBoy,
            closes vim/vim#1240)
12c4492dd3

vim-patch:8.0.0153
Problem:    system() test fails on MS-Windows.
Solution:   Deal when extra space and CR.
9d9c356517

vim-patch:8.0.0154
Problem:    system() test fails on OS/X.
Solution:   Deal with leading spaces.
31f19ce0a0
2018-01-15 23:50:40 +01:00
Jan Edmund Lazo
ab1e11e44f test: win: yes is unavailable on Windows 2018-01-06 17:50:49 +01:00
Jan Edmund Lazo
d4485f7cc0 win: test: check non-shell system() 2018-01-06 17:49:42 +01:00
Jan Edmund Lazo
8d58012786 test: use unix fileformat to test NULs on systemlist 2018-01-06 17:49:42 +01:00
ZyX
023631463c functests: Fix linter error 2017-12-16 16:14:53 +03:00
ZyX
fb07391ce4 window: Fix matchaddpos() and enhance error reporting 2017-12-15 11:38:34 +03:00
ZyX
c8a5d6181b *: Fix some problems found during review
Still missing: problems in window.c, it should be possible to construct a test
for them.
2017-12-15 02:39:46 +03:00
ZyX
1a961b5750 eval: Fix add() 2017-12-11 10:34:58 +03:00
ZyX
ceb45a0885 *: Fix test failures 2017-12-11 01:43:36 +03:00
ZyX
622d355ab4 functests: Add some more NULL tests 2017-12-10 23:16:00 +03:00
ZyX
d11884db49 eval: Fix uniq() crash in legacy test 055 2017-12-10 23:02:19 +03:00
ZyX
0b03ac2cb2 functests: Mark islocked("v:_null_list") behaviour correct
It is the same for other VAR_FIXED lists.
2017-12-10 22:34:32 +03:00
ZyX
83f77c80c0 quickfix: Fix :cexpr and :lexpr 2017-12-10 22:33:05 +03:00
ZyX
5008205a3e eval: Fix setmatches(), setqflist() and setloclist() 2017-12-10 22:28:18 +03:00
ZyX
f572bd7e4e eval,functests: Fix tests and complete() and setline() behaviour 2017-12-10 22:24:11 +03:00
ZyX
ac4bbf55f6 *: Hide list implementation in other files as well 2017-12-10 22:04:43 +03:00
ZyX
5c1ddb5078 eval: Fix writefile() 2017-12-10 04:00:54 +03:00
ZyX
21745d72b8 eval: Fix inputlist() 2017-12-10 04:00:54 +03:00
ZyX
274f32d42e *: Start hiding list implementation
Most of files, except for eval.c and eval/* were only processed by perl.
2017-12-10 04:00:52 +03:00
FlorianGit
d763d2fe7a Viml: Make filter and map handle null list correct
filter('v:_null_list, 'v:val') should return v:_null_list and a similar
statement should hold for map.

Changes after review

 * Test inserted in legacy test suite has been removed by reverting the commit
adding it.
 * Change the fix to tv_copy the argument before returning.
 * Readd the two tests on crashes, and modified their expected return value.
 * Move the test from 'incorrect behaviour' section to 'correct behaviour section'
 * Add analogous tests for v:_null_dict

Always copy list or dictionary to return variable

If the type of input is correct (i.e. either a list or a dictionary), this
should also be returned.
2017-12-03 17:03:31 +01:00
Marco Hinz
9837a9c401 compat: "v:count" distinct from "count" (#7407) 2017-11-09 02:20:12 +01:00
Adrian Neumann
8f03014e88 eval/decode.c: Avoid NULL arg to memchr() #7332
Clang complains because memchr has undefined behavior if the ptr is
NULL, even if len==0.

Helped-by: Nikolai Aleksandrovich Pavlov <kp-pav@yandex.ru>
2017-11-06 05:00:58 +01:00