Commit Graph

194 Commits

Author SHA1 Message Date
Justin M. Keyes 019c8d13dd
build/doc/CI: remove/update quickbuild references #11258 2019-10-19 18:04:08 -07:00
Daniel Hahler d89ec55c45 test/functional: retry/Screen: failure instead of error #11173
- Running out of retries, or unexpected screen state should make the
  test FAIL, not ERROR.
- Uses levels to report the location of the caller.
- Improve message with retry-failure (formatting).

Before:

    [ RUN      ] test: 103.53 ms ERR
    test/functional/helpers.lua:388:
    retry() attempts: 1
    test/functional/ui/screen.lua:587: Row 1 did not match.
    Expected:
      |*X^                         |
      |{0:~                        }|
      |{0:~                        }|
      |                         |
    Actual:
      |*^                         |
      |{0:~                        }|
      |{0:~                        }|
      |                         |

    To print the expect() call that would assert the current screen state, use
    screen:snapshot_util(). In case of non-deterministic failures, use
    screen:redraw_debug() to show all intermediate screen states.

    stack traceback:
            test/functional/helpers.lua:388: in function 'retry'
            test/functional/test_spec.lua:24: in function <test/functional/test_spec.lua:23>

After:

    [ RUN      ] test: 105.22 ms FAIL
    test/functional/test_spec.lua:24: stopping after 1 retry() attempts.
    test/functional/test_spec.lua:25: Row 1 did not match.
    Expected:
      |*X^                         |
      |{0:~                        }|
      |{0:~                        }|
      |                         |
    Actual:
      |*^                         |
      |{0:~                        }|
      |{0:~                        }|
      |                         |

    To print the expect() call that would assert the current screen state, use
    screen:snapshot_util(). In case of non-deterministic failures, use
    screen:redraw_debug() to show all intermediate screen states.

    stack traceback:
            test/functional/helpers.lua:389: in function 'retry'
            test/functional/test_spec.lua:24: in function <test/functional/test_spec.lua:23>
2019-10-19 14:15:07 -07:00
Jan Edmund Lazo a7fc2f3f64 test: "!:&" works with powershell #11201
Removed 'echo' alias because it does not behave like POSIX echo.
2019-10-10 21:30:20 -07:00
Jan Edmund Lazo 51f2826f61 doc: update shellquote for powershell #11122
shellquote is not treated like shellxquote for non-quote values.
2019-10-10 01:16:02 -07:00
Daniel Hahler e452988960
tests/functional: keep $TMPDIR in env (#11163) 2019-10-06 22:26:54 +02:00
Björn Linse dd26bd5974 screen: don't crash on invalid grid cells being recomposed 2019-09-30 19:05:54 +02:00
Justin M. Keyes ffdf8c4c12 Context: rename "buflist" => "bufs"
Given the other type names "jumps", "vars", etc., the name "buflist"
is somewhat unintuitive.
2019-09-14 18:57:35 -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
Björn Linse c705e3fb0b update tests for new resize behavior (resize at pager, but not at :!cmd) 2019-09-08 15:24:14 +02:00
Justin M. Keyes af946046b9 test: Rename meth_pcall to pcall_err
- Rename `meth_pcall`.
- Make `pcall_err` raise an error if the function does not fail.
- Add `vim.pesc()` to treat a string as literal where a Lua pattern is
  expected.
2019-09-06 17:19:07 -07:00
Daniel Hahler fd8b00bacd tests: do_rmdir(): improve error handling #10955 2019-09-06 09:19:57 -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 ead39d6ce6 test/uname(): always lowercase 2019-09-01 22:49:33 -07:00
Justin M. Keyes 78ec7981c8 screen.lua: dump payload on handler failure
For debugging failures like:

    test/functional/helpers.lua:240: test/functional/ui/screen.lua:898:
    bad argument #1 to 'unpack' (table expected, got number)

    test/functional/helpers.lua:240: test/functional/ui/screen.lua:708:
    attempt to index local 'item' (a number value)

ref #10804
2019-09-01 22:49:33 -07:00
Justin M. Keyes 2c1749ce44 test: assert_alive() 2019-09-01 09:03:46 -07:00
Daniel Hahler 6cc76194b2
tests: use runtime from build for doc/tags with :help (#10479)
This is better practice in general, and allows to remove the "helptags
ALL" hacks.

Ref: https://github.com/neovim/neovim/issues/8824
Ref: https://github.com/neovim/neovim/commit/f1b67c3453c

* Makefile: fix dependencies with regard to helptags

- use the file as the main target to avoid unnecessary triggering
- use "make oldtest" on Travis to ensure it gets built
2019-08-28 22:47:54 +02:00
Daniel Hahler 3bf0d54bc1 test/functional/helpers.lua: env: forward also TSAN_OPTIONS/MSAN_OPTIONS 2019-08-21 02:39:10 +02:00
Daniel Hahler fa0c677a63
tests/functional: expect_msg_seq: use load_adjust (#10727)
Regardless of the comment "Big timeout for ASAN/valgrind" it would use
10s by default already.
This changes it to use `load_adjust`, which itself is only computed on
CI now, and outside of any tests - since it has side effects when being
used the first time!

The failure seen on AppVeyor:

    [ RUN      ] jobs can get the pid value using getpid: ERR
    test\functional\helpers.lua:167:
    ==============================================================================
    got 0 messages (ignored 0), expected 1
    stack traceback:
            test\functional\helpers.lua:167: in function 'expect_msg_seq'
            test/functional\core\job_spec.lua:288: in function <test/functional\core\job_spec.lua:281>

Log: https://ci.appveyor.com/project/neovim/neovim/builds/26537324/job/y1io66fbx399q7h6?fullLog=true#L6554
2019-08-09 15:32:38 +02:00
Justin M. Keyes 4bb728dfa0
test: Minimize shada/helpers.lua #10728 2019-08-09 10:23:57 +02:00
Daniel Hahler e4bd31dbac
tests: use module pattern with test/functional/helpers.lua (#10724) 2019-08-08 16:03:25 +02:00
Abdelhakeem a80f691a6a API: Context 2019-07-27 16:36:56 +02:00
erw7 53d1801b49 tests: win: fix "cat" with PowerShell
Ref: https://github.com/neovim/neovim/pull/10580#issuecomment-514884092
2019-07-26 21:45:24 +02:00
Justin M. Keyes 097f85ae6c
defaults: wildoptions=pum,tagfile #10384
ref #6289
2019-07-01 23:59:24 +02:00
Björn Linse d33aaa0f5f libluv: use luv_set_callback to control callback execution
Disable the use of deferred API functions in a fast lua callback
Correctly display error messages from a fast lua callback
2019-06-30 13:13:08 +02:00
Daniel Hahler 93f8c2793c
ci: AppVeyor: fix cov job, remove duplicate non-cov one (#10217)
* ci: AppVeyor: set GCOV_ERROR_FILE

This prevents the warnings/errors to be spilled into test results,
causing them to fail them, e.g.:

    [  FAILED  ] C:/projects/neovim/test/functional\core\main_spec.lua @ 97: Command-line option -s errors out when trying to use nonexistent file with -s
    C:/projects/neovim/test/functional\core\main_spec.lua:98: Expected objects to be the same.
    Passed in:
    (string) 'Cannot open for reading: "Xtest-functional-core-main-s.nonexistent": no such file or directory
    profiling:C:\projects\neovim\build/src/nvim/CMakeFiles/nvim.dir/buffer.c.gcda:Data file mismatch - some data files may have been concurrently updated without locking support
    '
    Expected:
    (string) 'Cannot open for reading: "Xtest-functional-core-main-s.nonexistent": no such file or directory
    '

    stack traceback:
            C:/projects/neovim/test/functional\core\main_spec.lua:98: in function <C:/projects/neovim/test/functional\core\main_spec.lua:97>

For reference, the locking appears to have been reworked for gcc 9.1 [1].

1: https://github.com/gcc-mirror/gcc/commit/56621355b

helpers.clear: keep GCOV_ERROR_FILE in environment

* ci: AppVeyor: remove MINGW_64 config (used with cov now)

Also:

- run MINGW_64-gcov first, and with PRs, since it provides coverage.
2019-06-14 13:39:57 +02:00
Justin M. Keyes bb24fec333
defaults: exclude "S" from 'shortmess' #10136
ref #6289
2019-06-07 23:11:28 +02:00
Björn Linse 8ed54bbec3 messages: use proper multiline error message for rpcrequest and API wrappers 2019-05-26 15:42:16 +02:00
Justin M. Keyes 9d7aaf7149 lua/shared: move table util funcs to vim.shared
Use `tbl_` prefix for all table-util functions. Specify in the function
docstring if it expects a list-like or map-like table.
2019-05-18 21:07:30 +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 7669fc1e9b test: share implementation of testdir/load.vim
Also, don't compute load factor unless load_adjust() was called, it
slows down the test suite.

ref #9292
2019-05-18 15:48:13 +02:00
Justin M. Keyes bba75eb184 lua/stdlib: Introduce vim.shared
This is where "pure functions" can live, which can be shared by Nvim and
test logic which may not have a running Nvim instance available.

If in the future we use Nvim itself as the Lua engine for tests, then
these functions could be moved directly onto the `vim` Lua module.

closes #6580
2019-05-18 15:48:13 +02:00
Justin M. Keyes 2b87485c22 test: Extend {unit,functional}.helpers with global helpers
Automatically include all "global helper" util functions in the
unit.helpers and functional.helpers and modules.  So tests don't need to
expicitly do:

    local global_helpers = require('test.helpers')
2019-05-18 14:51:01 +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 698c4f662d test: clear(): remove `opts.headless` parameter
Callers can instead specify `args_rm={'--headless'}`.

TODO: should `nvim_argv` have "--headless" by default? Need to inspect
      some uses of spawn(nvim_argv) ...
2019-04-27 16:31:26 +02:00
Justin M. Keyes 17291642bd test: clear(): `args_rm` parameter 2019-04-27 16:19:40 +02:00
Justin M. Keyes f0a7e3fc9a test: 'shadafile' default
ref 773bdd41ec
2019-04-27 16:19:40 +02:00
Justin M. Keyes 7e1591e06a API: emit nvim_error_event on failed async request
We already do this for _invalid_ async requests #9300.
Now we also do it for failed invocation of valid requests.
2019-04-13 17:07:58 +02:00
Justin M. Keyes 8093cbd8e8
Merge #9292 from mhinz/xcode10 2019-01-17 23:24:03 +01:00
Matěj Cepl a8a38f3465 test: Lua 5.2/5.3 compat
close #9515
ref #9280
2019-01-17 23:06:04 +01:00
Marco Hinz f2e996b991
tests: load-adjust timer tests (functionaltest) 2019-01-17 15:59:23 +01:00
Björn Linse 1f8afe15a4 multigrid: add multigrid support to test infrastructure
make Screen explicitly tied to its session
2018-12-31 12:44:22 +01:00
Justin M. Keyes 221f6fffad runtime/lua/vim/compat.lua
ref #9280
Introduce the `vim.compat` module, to help environments with system Lua
5.2+ run the build/tests. Include the module implicitly in all tests.

ref #8677
legacy `vim` module:
    beep
    buffer
    command
    dict
    eval
    firstline
    lastline
    line
    list
    open
    type
    window
2018-12-20 11:57:30 +01:00
Matěj Cepl e6d0dea42b test: Lua 5.2/5.3 compat #9280
Make the code run both on Lua 5.1 (which is the default for Neovim, and
is what LuaJIT provides) and Lua 5.2+.
2018-12-20 11:57:30 +01:00
Björn Linse 8b42249cdd RPC: turn errors from async calls into notifications
Previously, nvim sent a response with invalid request id (UINT64_MAX).
In functionaltests, catch unexpected error notifications in after_each().
2018-12-03 10:42:00 +01:00
Justin M. Keyes f8639dc99c
test: adjust time-sensitive tests (#9220)
- window_split_tab_spec.lua: Put cursor at bottom of :terminal buffer so
  that it follows output.
- inccommand_spec.lua: Increase timeout to allow 2nd retry.
- Timer tests are less reliable on Travis CI macOS 10.12/10.13.
  ref #6829
  ref e39dade80b
  ref de13113dc1
  ref https://github.com/neovim/neovim/pull/9095#issuecomment-429603452
  > We don't guarantee that a X ms timer is triggered during Y ms sleep
  > for any X<Y, though I would expect the load to be really bad for this
  > to happen with X=10ms, Y=40ms.
2018-11-10 11:12:04 +01:00
Björn Linse 4da5cb38d3 startup: always wait for UI with --embed, unless --headless also is supplied 2018-09-22 10:18:28 +02:00
Björn Linse bd8d43c6fe startup: wait for embedder before executing startup commands and files
Give embeders a chance to set up nvim, by processing a request before
startup. This allows an external UI to show messages and prompts from
--cmd and buffer loading (e.g. swap files)
2018-09-18 19:22:16 +02:00
Marcos Almeida a2253744c9 system(): handle profiling and 'verbose' #8730
closes #8362

Vim's code calls `call_shell` directly from `get_system_output_as_rettv`
whereas in Nvim this function has been rewritten to not call `call_shell` but to call
`os_system` via `do_os_system`, losing the support for profiling and verbose.

Changing the code to call `call_shell` from `get_system_output_as_rettv`
seems to be too complicated to be worth it on the current version of the
code. So this commit duplicates the relevant code.
2018-07-29 03:49:11 +02:00
Justin M. Keyes d8c7ff1335 cleanup, test interactive -E 2018-06-04 02:09:28 +02:00
Justin M. Keyes d6a1640260 test/util: move general functions into global helpers 2018-04-27 13:06:41 +02:00