Commit Graph

315 Commits

Author SHA1 Message Date
Justin M. Keyes
0603eba6e7
feat(api): nvim_get_chan_info: include "argv" for jobs #15537
ref #15440
2021-09-01 07:29:38 -07:00
Sean Dewar
e0bdc9b89c
fix(eval): cherry-pick emsg changes from v8.1.0736
v8.1.0736 made some changes for making some emsgs more specific.
Includes the change for Test_lambda_fails() in test_lambda.vim.
Adjust relevant functionaltests to expect the new emsgs.

This patch has been fully ported in my Blob port PR, but it hasn't been
merged yet, so just use what we need from it for now.

Required for v8.1.1821.
2021-08-12 17:16:33 +01:00
Gregory Anders
f83763b261 Add test case for 'null' stdin mode 2021-07-12 13:22:56 -06:00
Justin M. Keyes
05330ba508
doc/startup: cleanup; assign ENN to "conflicing configs" msg (#14971) 2021-07-03 06:31:00 -07:00
shadmansaleh
27ea0d37e1 Refactor(tests): mkdir_p in startup/init.lua test 2021-07-01 08:25:55 +06:00
shadmansaleh
1f280b582f fixup(runtime): Fix lua runtime files not listed
lua runtime files weren't listed in :scriptname & profiler.
This fixes that.

* Add tests

* Small doc tweeks
2021-06-13 00:27:52 +06:00
shadmansaleh
92b6b3764c refactor(tests): Simplify tests at functional/lua/runtime_spec 2021-06-11 01:01:03 +06:00
shadmansaleh
1e6c02510a feat(runtime): Allow lua to be used in colorschemes
* tests(runtime): move runtime/plugin tests to functional/lua/runtime_spec
2021-06-11 01:01:02 +06:00
shadmansaleh
687eb0b39f feat(startup): Source runtime/plugin/**/*.lua at startup
For opt plugins these files are sourced on `:packadd`

* `:runtime` Now can exexute lua files
2021-06-11 00:58:38 +06:00
James McCoy
d250905c69
test(job_spec): Test handling of case-insensitively matching env vars
Since Windows is case-insensitive, there should only be a single env var
in visible in the resulting job.  However, non-Windows should see both.
2021-05-18 06:53:03 -04:00
Björn Linse
3d6831a30a api: fix use-after-free in nvim_chan_send 2021-04-04 18:11:48 +02:00
James McCoy
db734ae994
test(job): Ensure job-specific env var overrides global env var 2021-01-31 07:54:21 -05:00
James McCoy
a199363be2
Pass environment on to pty processes on Windows
vim-patch:8.2.0239: MS-Windows: 'env' job option does not override existing vars

Problem:  MS-Windows: 'env' job option does not override existing
          environment variables.  (Tim Pope)
Solution: Set the environment variables later. (Yasuhiro Matsumoto,
          closes vim/vim#5485, closes vim/vim#5608)
355757aed6

Co-authored-by: erw7 <erw7.github@gmail.com>
2021-01-31 07:54:21 -05:00
James McCoy
7f50c69268
Use dict_T to pass env vars to process spawning code
Co-authored-by: Matthieu Coudron <mattator@gmail.com>
2021-01-31 07:54:20 -05:00
Edwin Pujols
f2ec058602
tests: Take into account magic hyphen. (#13518)
In Lua patterns the hyphen works like a non-greedy version of Vim's `*`.
- Use `%-` when you need a literal hyphen.
- If you don't need a regular expression at all, use something like
  ```
  string.find(text, pattern, 1, true)
  ```
  so that the pattern is regarded as a plain, non-magical string.
  See [1] and [2] in the Lua manual.

[1]: https://www.lua.org/manual/5.1/manual.html#pdf-Patterns
[2]: https://www.lua.org/manual/5.1/manual.html#pdf-string.find
2020-12-11 18:54:39 -05:00
dm1try
33f324796c startup: allow lua files as session one 2020-12-01 10:51:31 +01:00
dm1try
767cd8b17b startup: add init.lua as an alternative user config, fixes #7895 2020-12-01 10:51:25 +01:00
Björn Linse
a119fe15da startup: load files from &packpath . '/start/{pluginname}'
Quoting the existing docs:

    Packages are loaded.  These are plugins, as above [&runtimepath], but
    found in the "start" directory of each entry in 'packpath'.  Every
    plugin directory found is added in 'runtimepath' and then the plugins
    are sourced.

Also tj didn't think I could do it.
2020-11-19 14:31:07 +01:00
Björn Linse
c60c7375f5 startup: handle autoload and lua packages during startup
¡NO HAY BANDA!
2020-11-02 15:21:36 +01:00
Björn Linse
07cc231142 A Mudholland Dr. Recast
The commit summary maybe does not make sense, but calling a function
that does not wait on anything `wait()` makes even less sense.
2020-10-19 21:48:06 +02:00
Omri Sarig
f520c1ef85
test: Fix failing test in case of special .bashrc (#12920)
The test of "replace environment" in the test module of
`test/functional/core/job_spec.lua` failed in case the bashrc file of
the user running the test has special actions in it (such actions were
printing to the screen from inside this file, or changing the bash mode
to be vi).

In order to fix this problem, the test now sets the shell to be
`/bin/sh` before running the command. Setting the shell to be `/bin/sh`
causes the running shell to run without the configuration of the user,
and so the test passes even in case of special .bashrc.
This change was done only for platforms other than Windows since it is
not relevant in windows.

The fix was applied to the specific test, even though it is possible
that related issues will arise in other tests. It seems like a big
overhead to make the fix work on all the possible tests, and it does not
worth this cost.
2020-09-28 22:20:49 +02:00
erw7
8e350c1c69
startup: fix stall issue with -D options (#12652)
fixes #12647.
2020-07-19 17:44:22 +02:00
Jan Edmund Lazo
a5bde56b37
vim-patch:8.0.1554: custom plugins loaded with --clean
Problem:    Custom plugins loaded with --clean.
Solution:   Do not include the home directory in 'runtimepath'.
0726870326
2020-06-18 18:01:41 -04:00
kuuote
e89462d985
vim-patch:8.1.2233: cannot get the Vim command line arguments (#12117)
Problem:    Cannot get the Vim command line arguments.
Solution:   Add v:argv. (Dmitri Vereshchagin, closes vim/vim#1322)
69bf634858
2020-05-24 20:45:25 +02:00
Kei Kamikawa
c6dc397801
fixed hang issue with --headless and -r option specified (#12209)
* fixed hang issue with --headless and -r option specified

Calling the do_more_prompt function in headless mode will freeze neovim because it is eventally in the input-accepting state (the same as waiting for --more--).

* fixed "Press ENTER or type command to continue" to be suppressed

If in headless mode, we need to exit at this point. If we continue, we will enter the normal mode and the message "Press ENTER or type command to continue" will be displayed and we will be in the input waiting state.

* fixed functional ex_cmds tests

* Revert "fixed "Press ENTER or type command to continue" to be suppressed"

This reverts commit a02dc40e3b.

* Revert "fixed functional ex_cmds tests"

This reverts commit 3bdb8da20a.

* fixed conditional again

* added test for fixed hang issue with --headless (#11386)
2020-05-20 10:32:02 -04:00
Billy Su
041ec8997a Fix f_jobstop() failed loudly
The return value of jobstop()
@return 1 for valid job id
        0 for invalid id, including jobs have exited or stopped
2020-01-22 17:30:43 +08:00
Daniel Hahler
b3686b1597 system(), jobstart(): raise error on non-executable #11234
* tv_to_argv: error when cmd is not executable
  Callers always assume that emsg was emitted:
  - https://github.com/neovim/neovim/blob/57fbf288/src/nvim/eval.c#L12509
  - https://github.com/neovim/neovim/blob/57fbf288/src/nvim/eval.c#L17923
  - https://github.com/neovim/neovim/blob/57fbf288/src/nvim/eval.c#L18202
* test/functional/provider: display reason from missing_provider
* provider#node#Detect: skip / handle non-existing node executable
2019-12-24 07:53:56 +01:00
James McCoy
91b313a904
Add negative test for type of job's env option 2019-12-12 07:57:27 -05:00
Matthieu Coudron
f3fcaedfad
test: new test for setting environment 2019-12-11 21:06:42 -05:00
Joe Hermaszewski
1ff5b60cb9 vim-patch:8.1.0251: support full paths for 'backupdir' #11269
Problem:    Using a full path is supported for 'directory' but not for
            'backupdir'. (Mikolaj Machowski)
Solution:   Support 'backupdir' as well. (Christian Brabandt, closes vim/vim#179)
b782ba475a
2019-11-17 23:38:27 -08:00
Björn Linse
f707a7ef68 terminal: add tests for palette color forwarding 2019-11-03 10:14:58 +01:00
Daniel Hahler
4bbad54817
tests: fix non-controversial misuse of pending (#11247)
Ref: https://github.com/neovim/neovim/pull/11184
2019-10-18 04:46:30 +02:00
Björn Linse
4987311fb5 tests/ui: remove unnecessary screen:detach()
It is perfectly fine and expected to detach from the screen just by
the UI disconnecting from nvim or exiting nvim. Just keep detach() in
screen_basic_spec, to get some coverage of the detach method itself.

This avoids hang on failure in many situations (though one could argue
that detach() should be "fast", or at least "as fast as resize",
which works in press-return already).

Never use detach() just to change the size of the screen, try_resize()
method exists for that specifically.
2019-10-13 22:10:42 +02:00
Justin M. Keyes
5a3c86205f test: fix failure on Windows (allow ".exe")
ref 77594d55f7
2019-09-13 16:31:21 -07:00
glacambre
77594d55f7 startup: fail if --embed with -es/-Es #10753
Closes https://github.com/neovim/neovim/issues/10031
2019-09-13 15:15:59 -07:00
Daniel Hahler
11fe132dd9
tests: fix system_spec when run with clipboard manager (#10956)
* tests: move os_kill to functional helpers

* tests: fix system_spec when run with clipboard manager

Replaces "xclip" with a dedicated helper program.

Fixes: https://github.com/neovim/neovim/issues/4900#issuecomment-501866842
2019-09-12 03:26:35 +02:00
Justin M. Keyes
9e0ce1a158 Merge #10973 'vim-patch:8.1.1197' 2019-09-08 20:58:36 -07:00
Jan Edmund Lazo
8dde9b58e5
vim-patch:8.1.1197: when starting with multiple tabs file messages is confusing
Problem:    When starting with multiple tabs file messages is confusing.
Solution:   Set 'shortmess' when loading the other tabs. (Christian Brabandt)
c75e812623
2019-09-08 23:16:54 -04:00
Justin M. Keyes
7e1c959861 test: Eliminate expect_err
Eliminate `expect_err` in favor of `pcall_err` + `eq` or `matches`.
2019-09-06 17:19:07 -07:00
Justin M. Keyes
540360a775
test: is_os() #10933
- Move os_name() up to "global helpers".
- Rename it to is_os().
- Make it depend on uname() instead of a running Nvim instance.
2019-09-04 06:58:04 -07:00
Justin M. Keyes
38806f23ed
test: enable "exit event follows stdout, stderr" [ci skip] #10929
- Update the test to work with changes since it was originally written.
- Keep the test pending() because it still fails:

      Expected objects to be the same.
      Passed in:
      (table: 0x50ce9e38) {
        [1] = {
          [1] = 'notification'
          [2] = 'stderr'
          [3] = {
            [1] = 0
            [2] = {
              [1] = '' } } }
       *[2] = {
          [1] = 'notification'
          [2] = 'stdout'
         *[3] = {
            [1] = 0
           *[2] = {
             *[1] = '' } } }
        [3] = {
          [1] = 'notification'
          [2] = 'exit'
          [3] = {
            [1] = 0
            [2] = 143 } } }
      Expected:
      (table: 0x50ce9870) {
        [1] = {
          [1] = 'notification'
          [2] = 'stderr'
          [3] = {
            [1] = 0
            [2] = {
              [1] = '' } } }
       *[2] = {
          [1] = 'notification'
          [2] = 'stdout'
         *[3] = {
            [1] = 0
           *[2] = {
             *[1] = 'abcdef' } } }
        [3] = {
          [1] = 'notification'
          [2] = 'stdout'
          [3] = {
            [1] = 0
            [2] = {
              [1] = '' } } } }
2019-09-03 10:25:27 -07:00
Justin M. Keyes
58318af718 jobwait(): fix race if job exits before waiting on it
Problem:  If a job exits while waiting on another job, the on_exit
          handler is queued but f_jobwait() skips it.
Solution: Always do process_wait(), so that handlers are run during
          f_jobwait().

fix #8302

Test case:
    $ BUSTED_ARGS="--repeat=2000 --no-keep-going" TEST_FILE=test/functional/core/job_spec.lua TEST_FILTER=waiting make functionaltest

Failure example (macOS CI):
    FAILED  test/functional/core/job_spec.lua: jobs jobwait will run callbacks while waiting
    test/functional/core/job_spec.lua:606: Expected objects to be the same.
    Passed in:
    (table: 0x1be77c80) {
      [1] = 'notification'
      [2] = 'wait'
     *[3] = {
       *[1] = 3 } }
    Expected:
    (table: 0x1be77d10) {
      [1] = 'notification'
      [2] = 'wait'
     *[3] = {
       *[1] = 4 } }
    stack traceback:
      test/functional/core/job_spec.lua:606: in function <test/functional/core/job_spec.lua:583
2019-09-03 16:14:29 +02:00
Justin M. Keyes
7233433f65 test/job_spec: improve visibility of flaky test
Test sometimes fails on macOS CI:

    FAILED  test/functional/core/job_spec.lua: jobs jobwait will run callbacks while waiting
    test/functional/core/job_spec.lua:606: Expected objects to be the same.
    Passed in:
    (table: 0x1be77c80) {
      [1] = 'notification'
      [2] = 'wait'
     *[3] = {
       *[1] = 3 } }
    Expected:
    (table: 0x1be77d10) {
      [1] = 'notification'
      [2] = 'wait'
     *[3] = {
       *[1] = 4 } }
    stack traceback:
      test/functional/core/job_spec.lua:606: in function <test/functional/core/job_spec.lua:583

Change the test to check if all jobs are starting, not only exiting.
2019-09-03 16:14:29 +02:00
Justin M. Keyes
ead39d6ce6 test/uname(): always lowercase 2019-09-01 22:49:33 -07:00
Edd Barrett
b64af88c84 CI/OpenBSD: run functional tests
Adapt some tests for OpenBSD:

- scrollback_spec:
  - seq(1) is not available on OpenBSD: we'd use jot(1).
  - Instead use a (hopefully) portable awk(1) snippet.
- channels_spec
- job_spec
- tui_spec
2019-09-01 22:49:33 -07:00
erw7
85edb33fd1 Change to output status on failure 2019-08-16 13:37:44 +09:00
erw7
e82fc20f23 windows: ok(#children >= 3 and #chidlen <= 5)
Depending on the version of Windows, conhost.exe may not be included in
the child process.
2019-08-16 13:34:53 +09:00
Daniel Hahler
ae60172106 windows: ok(#children >= 4 and #children <= 5) 2019-08-16 13:24:44 +09:00
Daniel Hahler
8fda095b6d tests: fix/improve "jobwait returns -1 when timed out" #10767
There was a longer timeout for Windows already, but unlike stated in
51d42917f it is not a worst-case, but gets waited for always.

The test is only about "-1" on timeout, so reduce it to this.

Fixes:

    16:33:19,309 INFO  - not ok 627 - jobs jobwait with timeout argument will return -1 if the wait timed out
    16:33:19,309 INFO  - # test/functional/core/job_spec.lua @ 707
    16:33:19,309 INFO  - # Failure message: test/functional/core/job_spec.lua:714: Expected objects to be the same.
    16:33:19,309 INFO  - # Passed in:
    16:33:19,309 INFO  - # (table: 0x0db1a3f0) {
    16:33:19,309 INFO  - #   [1] = 'notification'
    16:33:19,309 INFO  - #   [2] = 'wait'
    16:33:19,309 INFO  - #  *[3] = {
    16:33:19,309 INFO  - #    *[1] = {
    16:33:19,309 INFO  - #      *[1] = -1
    16:33:19,309 INFO  - #       [2] = -1 } } }
    16:33:19,309 INFO  - # Expected:
    16:33:19,309 INFO  - # (table: 0x0db1a480) {
    16:33:19,309 INFO  - #   [1] = 'notification'
    16:33:19,309 INFO  - #   [2] = 'wait'
    16:33:19,309 INFO  - #  *[3] = {
    16:33:19,309 INFO  - #    *[1] = {
    16:33:19,309 INFO  - #      *[1] = 4
    16:33:19,309 INFO  - #       [2] = -1 } } }
    16:33:19,309 INFO  - # stack traceback:
    16:33:19,309 INFO  - # 	test/functional/core/job_spec.lua:714: in function <test/functional/core/job_spec.lua:707>
2019-08-14 09:08:25 +02:00
Justin M. Keyes
ad4eb18e43 Merge #10098 'win: fix msg_puts_printf()' 2019-08-12 02:42:13 +02:00
Daniel Hahler
939d9053bd
channels: reflect exit due to signals in exit status code (#10573)
Uses `128 + term_signal` in case of exit due to a signal.

Fixes https://github.com/neovim/neovim/issues/10571.
2019-08-09 15:34:06 +02:00
Justin M. Keyes
94afc201bc test: isCI(): add "name" parameter 2019-08-05 04:02:41 +02:00
Daniel Hahler
41bb68b8e8 process_stop: uv: do not close stdin first/explicitly #10584
- process_stop: do not close stdin explicitly. The "close stdin" step was from
  aa9cb48, before we fixed/reworked the SIGTERM timing logic. So it's probably
  outdated / no longer needed.
- win: jobstop: exit_code 15
   GetExitCodeProcess appears to return the used signal.
   https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-getexitcodeprocess

ref #10573
2019-08-01 13:55:06 +02:00
Daniel Hahler
6e01ed6a4c vim-patch:8.1.0572: stopping a job does not work properly on OpenBSD
Problem:    Stopping a job does not work properly on OpenBSD.
Solution:   Do not use getpgid() to check the process group of the job
            processs ID, always pass the negative process ID to kill().
            (George Koehler, closes vim/vim#3656)
76ab4fd619

Ref: https://github.com/neovim/neovim/issues/9704
Ref: https://github.com/neovim/neovim/issues/10182#issuecomment-514450069
Closes https://github.com/neovim/neovim/pull/10660
2019-07-30 18:41:38 +02:00
Daniel Hahler
2906c702f9 tests: use "cat" also on Windows
Fixes https://github.com/neovim/neovim/issues/10574.

Keeps 'can be called recursively' pending for now, see
https://github.com/neovim/neovim/pull/10580#issuecomment-515295571.
2019-07-26 21:45:00 +02:00
Justin M. Keyes
bb3a0099c6 os/fs: introduce os_fopen()
Windows: Using fopen() directly may need UTF-16 filepath conversion. To
achieve that, os_fopen() goes through os_open().

fix #10586
2019-07-25 22:32:23 +02:00
Björn Linse
d4938743e6 channel: refactor events, prevent recursive invocation of events 2019-06-18 10:49:38 +02:00
Daniel Hahler
6f27f5ef91 main: do event_init before early_init #10183
Fixes https://github.com/neovim/neovim/issues/10172

* move log_init to event_init
* move init_signs to end of early_init
2019-06-12 14:22:42 +02:00
erw7
53551d823e Add test for #7967 2019-06-09 13:28:10 +09:00
erw7
89c2747eed Fix issue where test fails 2019-06-04 08:49:27 +09:00
Justin M. Keyes
7cc01c704c Merge #9709 'fileio: use os_copy to create backups'
ref #8288
2019-05-20 22:33:19 +02:00
Justin M. Keyes
fd04877eb0 test: remove use of require('test.helpers')
The test.functional.helpers and test.unit.helpers modules now include
all of the public functions from test.helpers, so there is no need to
separately require('test.helpers').
2019-05-18 15:48:13 +02:00
Justin M. Keyes
24f9dd73d5 test/channels_spec: cleanup
- Remove stray print()
- Use uname() instead of system('uname')
2019-05-12 00:43:28 +02:00
Justin M. Keyes
4b65a0059a test: cleanup
Avoid hyper-granularity. Don't need subdirectories for every little
thing.
2019-05-05 23:01:35 +02:00
Justin M. Keyes
fd0fd752c8 terminal: swap priority of terminal, editor highlights
closes #9964
2019-05-02 09:56:22 +02:00
Justin M. Keyes
17291642bd test: clear(): args_rm parameter 2019-04-27 16:19:40 +02:00
Justin M. Keyes
ddd0eb6f51
startup: -es/-Es (silent/batch mode): skip swapfile #8540
To use Nvim as a scripting engine the side-effects of swapfiles and user
config should be avoided by default.
2019-04-10 03:27:25 +02:00
Said Al Attrach
2bf18e7843
test: move trim to global helpers 2019-03-30 18:14:20 +01:00
Said Al Attrach
a9df3fa5d2
test: make first attempt at some kind of test 2019-03-24 00:21:26 +01:00
James McCoy
314f6ea367
startup: Use $XDG_CONFIG_DIRS/nvim/sysinit.vim if it exists
Closes #8994
2018-12-16 12:05:47 -05:00
Justin M. Keyes
32a30d90b4
highlight: Fix missing .rgb_sp_color in initializers (#9287)
terminal_get_line_attributes() had this bug for a long time, though it
likely had no effect visible to users.

ref #9028
ref 60f845ca55
2018-11-30 21:13:01 +01:00
Tommy Allen
c4c74c3883 jobstart(): Fix hang on non-executable cwd #9204
* os/fs.c: add os_isdir_executable()
* eval.c: fix hang on job start caused by non-executable cwd option
* channel.c: assert cwd is an executable directory
* test: jobstart() produces error when using non-executable cwd
2018-11-07 10:31:25 +01:00
Justin M. Keyes
f5671c8614 win: test: SIGWINCH is noisy #7506 2018-11-01 17:17:07 +01:00
Jan Edmund Lazo
8e44396794 functionaltest: enable buffered output tests 2018-10-31 22:55:07 -04:00
James McCoy
eb7b2c7912
Fix crash if --embed is used more than once 2018-10-03 07:29:08 -04:00
Justin M. Keyes
51d42917f0 test/win: job_spec: increase jobwait() timeout
powershell is slow, and this timeout is "worst case" so it doesn't make
the tests more costly, only avoids a false-positive.

close #8958
2018-09-05 22:05:05 +02:00
Björn Linse
3d88287e30 tests: introduce screen:expect{...} form 2018-08-27 15:15:49 +02:00
Justin M. Keyes
9625e9da75 startup: delete empty stdin buffer if other files were opened
DWIM: avoid empty buffer 1 when stdin was empty. If other files were
specified at startup, we assume that stdin is only accidentally
not-a-TTY: user did not intend to send text from it.

ref #8560
ref #8561
2018-06-18 21:51:42 +02:00
Justin M. Keyes
d44ed79ccc startup: go to buffer 2 if stdin is empty
If stdin is not a TTY we read it into buffer 1, as text. But if the
stdin pipe is empty, Nvim was most likely invoked for some other reason.
DWIM: select buffer 2 (if it exists). Example:

    echo file1 | xargs nvim

closes #8560
closes #8561
ref https://github.com/equalsraf/neovim-qt/issues/417
2018-06-18 17:51:38 +02:00
Justin M. Keyes
487cf98c0b startup: fix -E/-Es without -u NONE
Before this change, -E/-Es without `-u NONE` reads stdin as Ex commands.
It should always read stdin as text (into buffer 1), like this:

    echo foo | nvim -Es +'%p'
    foo
    echo foo | nvim -Es -u NORC +'%p'
    foo
2018-06-17 14:50:53 +02:00
Justin M. Keyes
9c2099d585 Ex mode: use getexline() instead of getexmodeline()
This changes Ex mode (Q, -e) to work like Vim's "improved Ex mode"
(gQ, -E).  That brings some small behavior differences, but should not
impact most Ex scripts (unless, for example, they depend on mappings
being disabled--but that can be solved for -e by skipping user config).

Before this change:
* the screen test hangs.

After this change:
* Q acts like gQ.
* -e/-es differs from -E/-Es only in its treatment of stdin.

This moves towards potentially removing getexmodeline().
(HINT: That does NOT mean "removing Ex mode", it means removing the
Vi-compatible Ex mode, which differs from Vim's "improved Ex mode" only
in some minor details (e.g. mappings are disabled).)

ref #1089 :-)~
2018-06-17 14:50:53 +02:00
Justin M. Keyes
dc5fdbc758 test: fix startup_spec
This behavior was changed (improved) by 5861dc5966 which actually
makes -E more faithful to Vim's behavior.
2018-06-10 16:27:13 +02:00
Justin M. Keyes
d8c7ff1335 cleanup, test interactive -E 2018-06-04 02:09:28 +02:00
Justin M. Keyes
1f300e08b8 win/startup: remove --literal
Fixes 2 failing tests in startup_spec.lua.

The Windows-only `--literal` option complicates support of "stdin-as-text
+ file-args" (#7679).  Could work around it, but it's not worth
the trouble:
- users have a reasonable (and englightening) alternative: nvim +"n *"
- "always literal" is more consistent/predictable
- avoids platform-specific special-case

Unrelated changes:
- Replace fileno(stdxx) with STDXX_FILENO for consistency (not motivated
  by any observed technical reason).
2018-06-04 02:09:27 +02:00
Justin M. Keyes
4211255c75 startup: allow explicit "-" file arg with --headless 2018-06-04 02:09:27 +02:00
Justin M. Keyes
63058fb5b0 startup: fix -es/-Es so they are actually silent
silent-mode (-es/-Es) has been broken for years.  The workaround up to
now was to include --headless.  But --headless is not equivalent because
it prints all messages, not the limited subset defined by silent-mode.
2018-06-04 02:09:27 +02:00
Justin M. Keyes
51e817dc1b startup: stdin as text instead of commands
Treat stdin as text by default (so the "-" file is not needed):
    echo foo | nvim

It works with file args (implemented in next commit), too:
    echo foo | nvim file1.txt file2.txt

Why? Because:
- Execution of input is (1) almost always unintentional/confusing,
  and (2) potentially destructive.
- Avoids the need for time-delayed warning.  #7659
- The _common_ case is to open text in a buffer, not send commands.

Note:
- Not for Ex-mode (-es) because it is used by scripts.  But maybe `-Es`?
- Not for --headless, because stdio may be a protocol stream and may be
  used for any purpose by stdioopen().

To treat stdin as Normal-mode commands, use `-s -` instead:
    echo ifoo | nvim -s -
Other alternatives:
  - Replay a register. E.g. the following mostly works, except @q aborts
    on any "beep" (e.g. if the cursor can't move).
    nvim -c '%d q|norm @q' -
  - Future: Let `:%source` work with unsaved buffer contents?

closes #2087
closes #7659
2018-06-04 02:07:39 +02:00
Björn Linse
a676c658cc channel: avoid references to non-rooted vimL list with output
likely fixes #7768 #7913

If multiple internal stream callbacks were recieved before vimL
callbacks got called, only invoke one vimL callback with all data.
2018-05-17 19:09:32 +02:00
Justin M. Keyes
77cb14cc6d API: nvim__stats()
Use it to verify fsync() behavior.
2018-04-24 00:44:06 +02:00
Justin M. Keyes
32f3937477 test: fsync() codepaths 2018-04-23 21:29:07 +02:00
Justin M. Keyes
be2a3ddd58
test: "Command-line option -s": avoid indeterminism (#8305)
closes #8303
2018-04-21 03:15:18 +02:00
Justin M. Keyes
7a13611ba2
Merge #8276 'startup: Make -s - read from stdin' 2018-04-17 10:33:36 +02:00
Justin M. Keyes
7598e6cf17
Merge #8120 'test: win: prefer cmd.exe' 2018-04-15 18:16:37 +02:00
b-r-o-c-k
387fbcd95c win: Fix reading from stdin
* Reading from stdin on Windows is fixed in the same way as it was in
  #8267.
* The file_read function was returning without filling the
  destination buffer when it was called with a non-blocking file
  descriptor.
2018-04-14 14:21:36 -05:00
b-r-o-c-k
ad999eaa77 Merge branch 'master' into s-dash-stdin 2018-04-14 14:17:51 -05:00
Björn Linse
aea079a25d channels: delay free so that libuv can cleanup handles
add test for a crash this caused
2018-04-12 18:22:47 +02:00
Jan Edmund Lazo
51f5cfc16e test: win: enable jobpid() tests
Use ping to test job detach
Use find.exe as an alternative to cat.exe
Use nvim_get_proc to check pid
2018-03-26 01:45:42 -04:00
Jan Edmund Lazo
ad6d577314 fixup: ping.exe works with cmd.exe pipe 2018-03-26 01:45:41 -04:00
Jan Edmund Lazo
e6ee06ee11 Revert "test/win: use cmd.exe for test"
This reverts commit ae409b5042.

This PR (#8120) defaults to cmd.exe for job_spec.lua
2018-03-26 01:45:41 -04:00
Jan Edmund Lazo
03e69a5d9c test: win: use find.exe /v "" as alternative cat - 2018-03-26 01:45:40 -04:00
Jan Edmund Lazo
3bd555f1e6 test: win: try stderr callback and slow output 2018-03-26 01:45:38 -04:00
Jan Edmund Lazo
cf4fbb6f04 test: win: use powershell for Start-Sleep only
cmd.exe (shell) is faster and more reliable than powershell (.NET frontend).
It's best for short and basic tests that don't require non-trivial scripting.
cmd.exe doesn't support sleep so use powershell's Start-Sleep as substitute.
2018-03-26 01:45:37 -04:00
Nimit Bhardwaj
8d64a2fb1d test: lua test for vim-patch:8.0.0184
2b7bc567b9
2018-03-24 23:06:09 +01:00
Justin M. Keyes
ae409b5042 test/win: use cmd.exe for test
Can revert this after #8120.
2018-03-18 17:15:06 +01:00
Justin M. Keyes
167898a517 test: jobstop() kills entire process tree
Test correctly fails before 8d90171f8b.
ref #6530
2018-03-18 17:03:05 +01:00
Justin M. Keyes
fd4021387e test: rename next_message() to next_msg() 2018-03-11 12:43:42 +01:00
Justin M. Keyes
2bf0869160 test: handle non-deterministic message cadence 2018-03-11 12:43:42 +01:00
Björn Linse
c57d315963
Merge pull request #8031 from bfredl/gotintstatus
jobwait: return -2 on interrupt even with timeout
2018-02-20 15:15:06 +01:00
Björn Linse
04fdbfe17d jobwait: return -2 on interrupt also with timeout 2018-02-20 12:32:23 +01:00
Jan Edmund Lazo
7fa69fb288 Resolve issues mentioned in PR review 2018-02-19 07:10:47 -05:00
Jan Edmund Lazo
3e19e18f4c win: enable job tests that use jobstart only
- echo "" does not hang in powershell
    - cmd.exe's echo command does not hang.
    - job tests default to powershell (WHY?)
- wait 5 seconds for powershell to create an empty file
    - powershell is slow
    - cannot reliably validate the id returned by jobstart via jobpid, jobstop
    - if using cmd.exe, waiting for a second should be enough
- remaining job tests are unreliable in Windows because any build can pass/fail
  for same conditions without changes, especially if the error is in stderr
2018-02-19 07:10:41 -05:00
Justin M. Keyes
e72ecdb7ca test/util: expect_msg_seq()
job_spec.lua on AppVeyor (Windows) often fails like this:

      FAILED  ] C:/projects/neovim/test/functional\core\job_spec.lua @ 72: jobs changes to given `cwd` directory
    C:/projects/neovim/test/functional\core\job_spec.lua:81: Expected objects to be the same.
    Passed in:
    (table) {
      [1] = 'notification'
      [2] = 'stdout'
     *[3] = {
        [1] = 0
       *[2] = {
          [1] = 'C:\projects\neovim\Xtest-tmpdir\nvimmSjq1S\0' } } }
    Expected:
    (table) {
      [1] = 'notification'
      [2] = 'stdout'
     *[3] = {
        [1] = 0
       *[2] = {
          [1] = 'C:\projects\neovim\Xtest-tmpdir\nvimmSjq1S\0'
         *[2] = '' } } }
    stack traceback:

Message chunking is non-deterministic, so we need to try different
variants.
2018-02-18 19:19:03 +01:00
George Zhao
499c9a1553 test/win: fix some environment assumptions #7912
fix #7909
fix #7910
2018-01-28 19:10:18 +01:00
Björn Linse
308dd53783 channel: check for existance before trying to set key
This avoids an error message in async context, where it is not safe.
2017-12-23 14:02:00 +01:00
ZyX
c49e22d396 Merge branch 'master' into s-dash-stdin 2017-12-03 16:49:30 +03:00
Björn Linse
e3c4c8a90e tests: mark flaky socket test pending for now 2017-11-27 11:43:24 +01:00
Björn Linse
91b856ccce channels: tests 2017-11-26 09:17:04 +01:00
Justin M. Keyes
54cac3033f test: startup_spec: cmd.exe escaping 2017-11-04 09:36:52 +01:00
Justin M. Keyes
68bef0a57d test: has("ttyin"), has("ttyout") 2017-11-04 09:36:52 +01:00
Josh Leeb-du Toit
9db42d4ce9 :cquit : take an error code argument #7336
closes #2699

ex_cmds.lua: use flags consistent with similar commands such as `cnext`.

upstream discussion:
"[patch] :qcuit can take exit code"
https://groups.google.com/d/msg/vim_dev/_PjyNbUKyRc/oPgr5_ZXc6AJ
2017-10-22 13:02:31 +02:00
Justin M. Keyes
6f7754dfa0 test: avoid extra clear() calls
also: various other cleanup
2017-10-02 01:46:16 +02:00
Ignas Anikevicius
2b133101cf win: vim_FullName(): force backslashes #7287
- Replace obvious cases of '/' literal with PATHSEP. (There are still
  some remaining cases that need closer inspection.)
- Fixup tests: ui/screen_basic

closes #7117
ref https://github.com/neovim/neovim/issues/2471#issuecomment-271193714
2017-10-02 00:48:30 +02:00
Drew Neil
ac52947838 Repair job_spec functional tests 2017-08-21 20:44:03 +01:00
Justin M. Keyes
92101947fe test: job_spec.lua: disable shada in test instance 2017-08-04 22:25:39 +02:00
ZyX
65fb622000 functests: Replace execute with either command or feed_command
Hope this will make people using feed_command less likely: this hides bugs.
Already found at least two:

1. msgpackparse() will show internal error: hash_add() in case of duplicate
   keys, though it will still work correctly. Currently silenced.
2. ttimeoutlen was spelled incorrectly, resulting in option not being set when
   expected. Test was still functioning somehow though. Currently fixed.
2017-04-09 03:24:08 +03:00
Justin M. Keyes
1ea9ebf112 test: Use workspace-local temp directory.
Closes #6291
2017-03-30 02:55:00 +02:00
ZyX
62108c3b0b functests: Disable system(-s -) test on Windows
Assume something with system() if second test hangs as well. Assume something 
with reading stdin if not.
2017-03-23 21:06:39 +03:00
ZyX
99b4f25b99 functests: Do not run termopen test on Windows 2017-03-23 21:04:45 +03:00
ZyX
7df4fc8941 functests: Test -s errors 2017-03-19 18:53:21 +03:00
ZyX
fdfa1ed578 main: Temporary fix assertion error
This variant uses `fdopen()` which is not standard, but it fixes problem on my 
system. In next commit `scriptin` will use `FileDescriptor*` from os/fileio in 
place of `FILE*`.
2017-03-19 16:09:48 +03:00
ZyX
d2268d5ebb functests: Do not check stdout, it is different on Windows 2017-03-19 14:13:21 +03:00
ZyX
29654cfee7 functests: Fix testlint errors 2017-03-19 14:13:21 +03:00
ZyX
d4639ea6d9 functests: Use Neovim instance and system() in place of lua io.popen 2017-03-19 14:13:21 +03:00
ZyX
38687ee394 functests: Make sure that line ending is LF and not CRLF 2017-03-19 14:13:21 +03:00
ZyX
1ea7541f65 functests: Alter the order of checks
Check whether `repeated_read_cmd` returned nil and did not actually run nvim or 
it did, but still returned nil for whatever reason.
2017-03-19 14:13:21 +03:00
ZyX
3cd7bf31e2 tests: Fix repeated_popen_r usage, rename the function 2017-03-19 14:13:21 +03:00
ZyX
0e9286a19e tests: Fix CI failures 2017-03-19 14:13:21 +03:00
ZyX
0320a58082 functests: Check that -s works as expected 2017-03-19 14:13:21 +03:00
Matthew Malcomson
f6946c68ae job-control: set CLOEXEC on pty processes. #5986
Before this change, new processes started with libuv prevented SIGHUP
from reaching pty processes (by keeping the ptmx file descriptor open).
2017-03-17 12:20:51 +01:00
James McCoy
d4dd447ded
win: test: Fix closure jobs test on Windows 2017-02-23 01:24:55 -05:00
Michael Ennen
ef8701610b Allow lambdas to be used with jobs, timers and dictwatchers. 2017-02-14 17:38:19 -07:00
Justin M. Keyes
bd16e116eb win: test: Enable jobstart() 'shell' test. (#5983) 2017-01-21 17:04:39 +01:00
Justin M. Keyes
7637df4b59 win: test: XXX: Disable some tests. 2017-01-19 09:55:57 +01:00
Justin M. Keyes
32c7971b2a win: fix warnings 2017-01-19 09:55:57 +01:00
Justin M. Keyes
e40946a5be win: test: enable job_spec.lua
- Default to powershell.
- Avoid hardcoded "-c".
- Remove ^M character from received lines.
- pending_win32(): clear() is unnecessary and it pollutes the tests.

Closes #3973
Helped-by: Rui Abreu Ferreira <raf-ep@gmx.com>
2017-01-19 09:55:57 +01:00
James McCoy
bde9bedb0b
job: Consume content from rbuffer before invoking the callback again
While a job callback is active, it may be invoked again.  Since the
data handled by the first invocation of the callback hasn't been marked
as consumed, the subsequent invocation will see the same data.

Reported-by: Daniel Hahler
Patch-by: oni-link
Closes #5889
2017-01-14 07:49:07 -05:00
Justin M. Keyes
82edcb593b Windows: enable more tests 2017-01-13 01:17:12 +01:00
Justin M. Keyes
c6a50ca82c test: jobclose(): Avoid indeterminism. (#5851)
stdout activity may reach the queue before `exit`; just discard it.

Observed on Travis CI, ubuntu "trusty" beta image:

    [ RUN      ] ...is/build/neovim/neovim/test/functional/core/job_spec.lua @ 509: jobs running tty-test program jobclose() sends SIGHUP
    ...is/build/neovim/neovim/test/functional/core/job_spec.lua:511: Expected objects to be the same.
    Passed in:
    (table) {
      [1] = 'notification'
     *[2] = 'stdout'
      [3] = {
        [1] = 0
        [2] = {
          [1] = '
    '
          [2] = '' } } }
    Expected:
    (table) {
      [1] = 'notification'
     *[2] = 'exit'
      [3] = {
        [1] = 0
        [2] = 42 } }
    stack traceback:
    	...is/build/neovim/neovim/test/functional/core/job_spec.lua:511: in function <...is/build/neovim/neovim/test/functional/core/job_spec.lua:509>
    [  FAILED  ] ...is/build/neovim/neovim/test/functional/core/job_spec.lua @ 509: jobs running tty-test program jobclose() sends SIGHUP (2.81 ms)
2016-12-31 08:59:44 -05:00
Justin M. Keyes
0b244de384 test: job_spec: Avoid unreliable screen test. 2016-12-23 18:28:54 +01:00
Justin M. Keyes
43ba7f4d98 eval.c: set_selfdict(): Fix invalid memory access. 2016-12-14 20:52:18 +01:00
Marco Hinz
5855f30cb1 Make VimL code compatible with merged Partial support (#5765)
Closes #5763.
2016-12-13 14:48:42 +01:00
Michael Ennen
5e4eb18eb0 Add some tests and cleanup. 2016-12-12 10:17:35 -05:00
Björn Linse
0f681c80e1 Make partials work with jobs, timers, and dictwatchers. 2016-12-12 10:17:35 -05:00
Justin M. Keyes
d32888073f test: jobstart() 2016-12-11 01:14:22 +01:00
Aaron Williamson
c8d5e9230e jobstart(): Return -1 if cmd is not executable. #5671
Closes #5465
2016-12-10 16:01:27 +01:00
Justin M. Keyes
933c873cae test: Handle SIGHUP in tty-test fixture.
Closes #5727
2016-12-07 17:22:37 +01:00
Marco Hinz
df2ffe48ce
Tests: add tests for v:exiting 2016-12-01 14:57:27 +01:00
Björn Linse
1d4563771b jobs: ensure calling jobclose() on a pty job sends SIGHUP. Closes #5619 2016-11-17 15:13:45 +01:00
Justin M. Keyes
6636e2a259 test: :terminal should not interrupt Press-ENTER
References #2748
2016-10-20 23:41:59 +02:00
Justin M. Keyes
ac819b8994 CI: Travis macOS: Skip tab left-drag tests.
These tests fail on master, so it's not a regression. Changes in #4874
(parent commit) seem to work (and pass most CI), so skipping these tests
is better than blocking the changes.
2016-09-12 03:42:51 +02:00
Rui Abreu Ferreira
9ce81f7b2b functionaltest: Create lua helper for os.tmpname()
In Windows Lua's os.tmpname() returns relative paths starting with \s,
prepend them with $TEMP to generate a valid path.

In OS X os.tmpname() returns paths in '/tmp' but they should be in
'/private/tmp'. We cannot use os_name() for platform detection because
some tests use tempname() before nvim is spawned, instead use one of the
following:

1. Set SYSTEM_NAME environment variable before calling the tests, it
   is set from CMAKE_SYSTEM_NAME(i.e. uname -s or 'Windows')
2. Call uname -s
3. Assume windows
2016-08-31 11:32:28 +01:00
Rui Abreu Ferreira
39c628d031 Mark some functional tests as pending in Windows 2016-08-26 08:21:41 +01:00
Björn Linse
2d60a15e25 job control: reuse common job code for rpc jobs
This makes stderr and exit callbacks work for rpc jobs
2016-08-20 12:55:35 +02:00
Justin M. Keyes
68d9198501 XXX: CI: Disable hanging test on Travis OSX.
Temporary change to avoid frequent hangs on Travis macOS/OSX builds.
Hang does not occur on Quickbuild OSX (Yosemite) build.
Reverting e9061117a5 avoids the hang, but causes
more serious regressions on many more systems.

Note that the job_spec hang only happens with the gcc-4.9 Travis OSX build.

References #5002
References #5029
2016-08-09 15:17:46 -04:00
Justin M. Keyes
ff93c9bd90 test: PTY descendants should not prevent exit. 2016-07-16 03:34:59 -04:00