Commit Graph

161 Commits

Author SHA1 Message Date
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