Commit Graph

23 Commits

Author SHA1 Message Date
Marco Hinz
4a69e55f39 test/functional: clean up according to luacheck (part 1) 2015-11-23 13:57:21 +01:00
Thiago de Arruda
c1edd07990 shell: Ensure silent bang mappings won't cut output
Setting `msg_didout` after `call_shell` is enough as it will cause
`hit_return_msg()` to print on next line.

Close #3269
2015-10-01 15:22:48 -03:00
Justin M. Keyes
5c1dc0fbe7 test: fix pending() invocations
AFAICT busted does not report pending() invocations without the 2nd
argument.
2015-08-09 22:33:28 -04:00
Florian Walch
122890463a tests: Use pending() instead of silently skipping test. #2737 2015-05-29 20:57:20 +03:00
Scott Prager
1eb3396922 unify jobstart, termopen, and system interfaces
For any of these functions, if {cmd} is a string, execute
"&shell &shellcmdflag '{cmd}'", or simply {cmd} if it's a list.

In termopen(), if the 'name' option is not supplied, try to guess using
'{cmd}' (string) or {cmd}[0] (list).  Simplify ex_terminal to use the
string form of termopen().

termopen: get name from argument

Convert list_to_argv to tv_to_argv.

Helped-by: Björn Linse <@bfredl>
Helped-by: oni-link <knil.ino@gmail.com>
Helped-by: Thiago de Arruda <@tarruda>
2015-05-02 09:47:30 -04:00
Michael Reed
0f6e25a9e4 messages: Update common instances of Vim to Nvim #2031 2015-04-08 23:05:39 -04:00
Thiago de Arruda
5199456471 test: Only display cursor marker in screen tests if nvim is not busy 2015-03-16 08:29:57 -03:00
Björn Linse
a7aeda8c7a tests/ui: Also test character at cursor 2015-03-09 08:01:49 -03:00
Thiago de Arruda
f9d327c88b test: Add extra screen expectation to prevent race condition
This is to ensure ctrl+c is only pressed after the command has started executing
in the viml_system_spec.lua system() interrupt test.
2015-02-20 20:41:03 -03:00
Thiago de Arruda
291e15c60a test: Remove unnecessary tests from viml_system_spec.lua
The `system` function is never executed with these tests because the ctrl+c is
queued with the input string that calls it(The `process_interrupts` function
will destroy all previous input when a ctrl+c is found).
2015-02-16 23:17:38 -03:00
Björn Linse
f4f0f646c3 api: always return empty string as api type String 2015-02-16 20:13:54 -05:00
Thiago de Arruda
11fa4f42fd test: Remove nondeterminism in systemlist interrupt tests
The systemlist test currently calls the `echo` command which can potentially
complete before being interrupted, causing random test failures.

Use `yes | xargs` instead. A `yes` invocation that is not piped through `xargs`
can produce a huge amount of lines in a very short time, leading memory
starvation when the result is being converted into a list. `xargs` ensures only
one line of output will be produced while allowing interrupt to be tested.
2015-02-06 15:24:08 -03:00
oni-link
d7d1b11332 Tests for system()/systemlist() when interrupted with CTRL-C. 2015-01-17 16:34:58 +01:00
Björn Linse
b3151af69c systemlist: test empty lines in beginning and middle of output 2014-12-02 16:53:16 +01:00
Björn Linse
1464b0eda2 systemlist: add keepempty option to preserve final newline 2014-12-02 16:50:52 +01:00
John Szakmeister
78618d742b Avoid printing an error response when detecting xclip.
While we're at, using the slightly more portable `command -v` technique
to detect the executable.  Also, there's no need to use `io.popen()` if
we aren't going to record the path.  Instead, let's use the simpler
`os.execute()` to detect the presence of xclip.
2014-11-26 17:31:51 -05:00
Thiago de Arruda
179c51319d test: Refactor functional helpers to use vim_input
The vim_input function accepts raw terminal input and so is better to emulate
real user, especially because it is not deferred as vim_feedkeys.

Using this function required a number of changes:

- expect() was refactored to use curbuf_contents()
- The vim_eval function in request() was moved to curbuf_contents(). For most
  cases this is enough(we only care for synchronizing api calls with user input
  when verifying buffer contents).
- <C-@>(NUL) is preprocessed before being passed to replace_termcodes.
- Legacy test 4 had a bug that only became visible when using vim_input, it is
  fixed now.
- An extra blank line deletion was required for test 101

The last two items show that vim_feedkeys because it is not 100% equivalent to
receiving terminal input.
2014-11-21 15:39:04 -03:00
Thiago de Arruda
3e8ef31ada shell: Use job_write_cb for closing stdin
Commit @45525853d352 removed usage of the `job_write_cb` for closing stdin due
to a memory error, but that doesn't work anymore because `job_close_in` closes
stdin immediately, possibly trimming input data before it is fully written.

Since most memory issues with jobs have been fixed, re-add the `job_write_cb`
call to ensure stdin is only closed when it should. Also add tests for scenarios
where using the callback makes a difference.
2014-11-10 18:47:46 -03:00
Thiago de Arruda
ab826d88f6 eval: Return an empty list from systemlist() when there's no output
This is the behavior on vim's `systemlist()`.
2014-11-10 18:47:03 -03:00
Scott Prager
860b6f6f05 test/shell: Add failure tests for system(). 2014-10-28 14:09:28 -03:00
Thiago de Arruda
d561ba223d job: Refactor to ensure that all callbacks will be invoked
It's possible that a child process won't close it's standard streams, even after
it exits. This can be evidenced with the "xclip" program:

    :call system('xclip -i -selection clipboard', 'DATA')

Before this commit, the above command wouldn't return, even though the xclip
program had exited. That is because `xclip` wasn't closing it's stdout/stderr
streams, which would block pending_refs from ever reaching 0.

Now the job.c module was refactored to ensure all streams are closed when the
uv_process_t handle is closed.
2014-10-23 21:19:08 -03:00
Thiago de Arruda
f7fab4af86 test: verify that v:shell_error is set by system()/systemlist() 2014-10-22 07:15:55 -03:00
Thiago de Arruda
35d7815eb2 test: Add some specs for the viml function system()
These new specs replace src/nvim/testdir/test_system
2014-10-01 21:41:54 -03:00