Commit Graph

2223 Commits

Author SHA1 Message Date
Pavel Platto
1d5222985c vim-patch:7.4.492
Problem:    In Insert mode, after inserting a newline that inserts a comment
	    leader, CTRL-O moves to the right. (ZyX) Issue 57.
Solution:   Correct the condition for moving the cursor back to the NUL.
	    (Christian Brabandt)

  https://code.google.com/p/vim/source/detail?r=v7-4-492
2015-01-19 23:39:01 +02:00
Justin M. Keyes
c7f4e55362 Merge pull request #1798 from oni-link/fix.job.wait
job.c: Prevent early return from job_wait().
2015-01-18 13:23:17 -05:00
oni-link
d7d1b11332 Tests for system()/systemlist() when interrupted with CTRL-C. 2015-01-17 16:34:58 +01:00
Nicolas Hillegeer
522a15f1c0 test: fix formatc.lua oddity on OSX/gcc
The primitive C canonicalizer we use to strip out duplicate header
declarations and keep luajit's ffi happy, didn't work properly in this case.

What happened is this (in /usr/include/ctype.h):

__DARWIN_CTYPE_TOP_inline int
isspecial(int _c)
{
        return (__istype(_c, _CTYPE_T));
}

Gets preprocessed to something like:

__inline int
isspecial(int _c)
{
        return (__istype(_c, _CTYPE_T));
}

On OSX/gcc. The formatter wasn't recognizing this entire function as
something to put on a single line because it naively just checks for
"static" or "inline" for that, but not "__inline".

This error doesn't occur on OSX/clang. Without looking further into it, I
guess that __DARWIN_CTYPE_TOP_inline gets defined to inline on clang, but
__inline on gcc, for some reason.

This helps issue #1572 along.
2015-01-16 21:45:00 +01:00
Nicolas Hillegeer
dd25b2e5ae test/os/fs: fix call to lfs.attributes
The second argument to lfs.attributes() serves only to select a specific
part of the normally returned table. It's not a file open flag (e.g.: as for
fopen() in C). Also made the (n)eq checks a bit more idiomatic.

Fixes #1831
2015-01-16 21:44:25 +01:00
Thiago de Arruda
dc18fa256f test: Add more functional test to cover new code
- emulate gui_running and terminal colors
- scrolling/clearing regions
- mouse wheel scrolling
- setting icon/title
- :stop/:suspend
- screen resize
2015-01-15 09:01:25 -03:00
Thiago de Arruda
8596776bf6 ui: Implement set_{title,icon} 2015-01-14 08:31:20 -03:00
Thiago de Arruda
ea771ac559 test: Add Screen.debug for inspecting screens of hanging tests 2015-01-13 21:21:20 -03:00
Thiago de Arruda
29bc6dfabd ui: Add 'rgb' parameter to ui_attach
When set to false, nvim will send cterm color numbers with `highlight_set`.
2015-01-13 11:54:52 -03:00
Thiago de Arruda
3e83e44792 input: Ignore invalid "<" key sequences
Ignoring invalid key sequences simplifies input handling in UIs. The only
downside is having to use "<lt>" everytime a "<" is needed on functional tests.
2015-01-13 11:54:51 -03:00
Thiago de Arruda
17b211d288 test: Remove unnecessary command from highlight_spec 2015-01-13 11:54:51 -03:00
Thiago de Arruda
926503c84e ui: Fix ui resizing and change some method names 2015-01-13 11:54:28 -03:00
Thiago de Arruda
fc8f768690 ui: Add update_fg/update_bg methods
It is necessary to notify the UI when the default background/foreground colors
change in order to render correctly.
2015-01-13 11:53:27 -03:00
Thiago de Arruda
1ccbd94bee test: Fix clear/eol_clear in screen.lua
These functions need to operate on the current the scroll region.
2015-01-13 11:53:27 -03:00
Justin M. Keyes
d7e18b5c95 Revert "[WIP] "abstract_ui" fixes and improvements" 2015-01-12 10:14:52 -05:00
Thiago de Arruda
d992213678 ui: Reimplement :suspend command for remote UIs.
- Remove suspend method from the UI protocol
- Handle `:suspend` by disconnecting the last channel that sent a request to
  nvim.
2015-01-12 09:47:41 -03:00
Thiago de Arruda
74c247f75b ui: Add 'rgb' parameter to ui_attach
When set to false, nvim will send cterm color numbers with `highlight_set`.
2015-01-12 09:47:41 -03:00
Thiago de Arruda
0219c87534 input: Ignore invalid "<" key sequences
Ignoring invalid key sequences simplifies input handling in UIs. The only
downside is having to use "<lt>" everytime a "<" is needed on functional tests.
2015-01-12 09:47:40 -03:00
Thiago de Arruda
d50d79831e test: Remove unnecessary command from highlight_spec 2015-01-12 09:47:40 -03:00
Thiago de Arruda
213c3c3e53 ui: Fix ui resizing and change some method names 2015-01-12 09:47:34 -03:00
Thiago de Arruda
4f5f246a95 ui: Add update_fg/update_bg methods
It is necessary to notify the UI when the default background/foreground colors
change in order to render correctly.
2015-01-10 21:41:31 -03:00
Thiago de Arruda
209b5ed6ba test: Fix eol_clear in screen.lua
It should only clear to the end of the current scroll region(this is the
behavior expected by nvim)
2015-01-10 21:41:31 -03:00
Justin M. Keyes
a31bcfb98a Merge pull request #1742 from fwalch/vim-7.4.552
vim-patch:7.4.552
2014-12-30 00:10:26 -05:00
Justin M. Keyes
13d950f6ed Merge pull request #1738 from fwalch/vim-7.4.549
vim-patch:7.4.549
2014-12-30 00:03:44 -05:00
Justin M. Keyes
ec615012a7 vim-patch:6a598be test for 7.4.487
https://code.google.com/p/vim/source/detail?r=6a598be6d4e8
2014-12-29 23:48:23 -05:00
Florian Walch
183b4b60b6 vim-patch:750a698
Add new files for 7.4.549.

https://code.google.com/p/vim/source/detail?r=750a6986aa86a2bb3346631a353913b899d86748
2014-12-27 13:16:54 +01:00
Florian Walch
e27460b60c vim-patch:7.4.552
Problem:    Langmap applies to Insert mode expression mappings.
Solution:   Check for Insert mode. (Daniel Hahler)

https://code.google.com/p/vim/source/detail?r=v7-4-552
2014-12-26 16:54:24 +01:00
Florian Walch
e06159e6ae vim-patch:7.4.488
Problem:    test_mapping fails for some people.
Solution:   Set the 'encoding' option. (Ken Takata)

https://code.google.com/p/vim/source/detail?r=v7-4-488
2014-12-23 21:23:49 +01:00
Florian Walch
6aecbbebfd vim-patch:7.4.483
Problem:    A 0x80 byte is not handled correctly in abbreviations.
Solution:   Unescape special characters. Add a test. (Christian Brabandt)

https://code.google.com/p/vim/source/detail?r=v7-4-483
2014-12-23 21:23:32 +01:00
Julian Mehne
84dda11ec3 Remove superfluous settings from legacy tests. 2014-12-18 00:50:17 +01:00
Thiago de Arruda
40977e78a2 input: Recognize mouse events for abstract_ui 2014-12-10 07:51:06 -03:00
Michael Reed
365cf90efb docs: Remove EBCDIC remnants 2014-12-09 19:25:07 -05:00
Thiago de Arruda
1192fbd08a test: Add screen test facility
- Add screen.lua which implements a remote screen to verify screen state by
  tests under functional/ui
- Add some basic screen/highlight tests
2014-12-09 08:36:16 -03:00
Björn Linse
6ddbe6d9be clipboard: fix let @+ = ... and add test 2014-12-08 22:05:05 +01:00
Björn Linse
d9639d3a9b clipboard: add functional test 2014-12-08 22:05:05 +01:00
Justin M. Keyes
01fc0efdca Merge pull request #1341 from splinterofchaos/api-nul
Api: Improve Nul handling
2014-12-06 20:19:08 -05:00
Scott Prager
cea5092f40 api: Add tests for when not to handle NULs. 2014-12-06 17:29:39 -05:00
Scott Prager
460843b4cd api: Handle NULs and newlines in buffer_*_line. 2014-12-06 17:29:38 -05:00
Julian Mehne
42891ea9d9 Make migrated test33 more similar to old legacy test.
Remove `expandtab` and add a missing trailing space from the legacy test.
2014-12-06 13:43:14 +01:00
Thiago de Arruda
a31b06c44d deps: Update lua client 2014-12-05 14:23:37 -03: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
Scott Prager
275f6e3a6b mch_early_init() -> early_init().
Move general initialization functions to early_init, which simplifies
test/unit/helpers.lua, which requires all these functions.
2014-11-28 14:27:58 -05:00
Rui Abreu Ferreira
84eb118f62 Functional tests for feedkeys CSI escaping
- tests for vim_feedkeys and replace_termcodes
2014-11-27 08:33:53 -03: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
Justin M. Keyes
c83dfa20bd Merge pull request #1543 from jszakmeister/fix-broken-functional-tests
Fix broken functional test.
2014-11-25 17:06:53 -05:00
Thiago de Arruda
99809903bb deps: Update bundled lua client version
The new version fixes defunct processes which causes random test failures on
some systems(#1519)
2014-11-25 14:47:54 -03:00
John Szakmeister
db914e8b61 Fix broken functional test.
In Lua, all math is floating point.  We need to coerce the result of a
division into a integer with the `{get,set}_height` and
`{get,set}_width` window_spec functional tests.
2014-11-25 06:11:43 -05:00
Thiago de Arruda
aa22612112 test: Add gdbserver support on helpers.lua
The $GDB env var can be set to run tests under gdbserver. If $VALGRIND is also
set, it will add the --vgdb=yes command-line option to valgrind instead of
starting gdbserver.
2014-11-23 08:56:43 -03:00
Eliseo Martínez
1f2c197ebe Fix functional-test-105 failure in OSX.
See https://github.com/neovim/neovim/issues/1519 for failure report.

Cause    : In OSX, /tmp is a symbolic link to /private/tmp, which causes
           expected and got results different because of implicit
           resolution.
Solution : Resolve path before setting expected value.
2014-11-21 22:08:16 +01:00
Thiago de Arruda
230c935e73 test: Fix problems in job_spec.lua
Nvim wasn't exiting cleanly in some job tests due to errors.

This can't be noticed until the next commit, which will perform a refactoring to
selectively process K_EVENT, so the `qa!` command executed at the end of each
test blocks forever if there are errors which require the user to press ENTER(in
that state Nvim no longer will process events).
2014-11-21 15:39:04 -03: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
6b17082d3c runtime: Refer to plugins running outside Nvim as "remote plugins"
- Rename autoload/rpc to autoload/remote
- External plugins are now remote plugins
- External plugins directory is "rplugin"
2014-11-21 10:11:42 -03:00
Rainer Borene
df5a17fb51 legacy tests: migrate test105 2014-11-20 21:06:37 -03:00
Rainer Borene
da3ade6a59 legacy tests: migrate test26 2014-11-20 21:06:37 -03:00
Rainer Borene
021d9bdcc0 legacy tests: migrate test101 2014-11-20 21:06:37 -03:00
Rainer Borene
50876c2f70 legacy tests: migrate test75 2014-11-20 21:06:37 -03:00
Rainer Borene
a93d370c75 legacy tests: migrate test51 2014-11-20 21:06:37 -03:00
Rainer Borene
c9159586b8 legacy tests: migrate test43 2014-11-20 21:06:37 -03:00
Rainer Borene
bbd95c0514 legacy tests: migrate test33 2014-11-20 21:06:37 -03:00
Rainer Borene
8c872a945e legacy tests: migrate test67 2014-11-20 21:06:37 -03:00
Rainer Borene
7fc5d6fc8e legacy tests: migrate test66 2014-11-20 21:06:37 -03:00
Rainer Borene
963a146e8b legacy tests: migrate test25 2014-11-20 21:06:37 -03:00
Rainer Borene
8ca8a0da08 legacy tests: migrate test104 2014-11-20 21:06:37 -03:00
Rainer Borene
e0332e7f7c legacy tests: implement :source helper method. 2014-11-20 21:06:37 -03:00
Rainer Borene
c152cdd0f3 legacy tests: migrate test5 2014-11-20 21:06:37 -03:00
Thiago de Arruda
f291f41525 test: Add tests for the python provider
These tests were adapted from the python-client repository
2014-11-18 14:58:31 -03:00
Thiago de Arruda
ca1d8673be test: Add tests for the rpc#define#* functions 2014-11-18 14:58:31 -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
Thiago de Arruda
63a98fca55 test: Fix nondeterminism in tests with notifications
Tests which spin the event loop and stop it in a notification handler have a
chance of re-entering the event loop due to the `vim_eval` call in the
`request()` helper(assuming the request call is what triggered the
notification). Since this will cause an error to be thrown by the lua client,
don't send the extra `vim_eval` request when the loop has been stopped.
2014-11-10 18:46:09 -03:00
Scott Prager
ea3296ad85 job_spec: Fix bad test. 2014-11-07 13:34:56 -03:00
Scott Prager
fd36dc208e job: Let vimL jobsend() accept a list.
Use save_tv_as_string(), same as vimL system(). This also makes
jobsend() more liberal in what it can accept. For example,
`jobsend(j, 123)` is now valid.

Closes #1176
2014-11-07 13:34:56 -03:00
Scott Prager
e90973e035 job: Make v:job_data[2] a list.
Factor out string_to_list() from f_system()'s implementation
and use that to set job_data. This has the technical advantage of
preserving NULs, and may be more convenient for users.

Required for #1176.
2014-11-07 13:34:56 -03:00
Thiago de Arruda
d3f81424e5 job: Only force-close stdout/stderr when the job exits
stdout/stderr should only be closed after the job truly exits, or else we can
lose data sent by it.
2014-11-07 09:12:42 -03:00
Thiago de Arruda
88a49148b3 test: Pass --show-possibly-lost=no to valgrind in helpers.lua
This command-line flag will suppress all warnings about interior pointers,
which are used in hashtab.c.
2014-11-07 01:40:18 -03:00
Thiago de Arruda
168a46fd31 test: Improve test environment setup and error handling/reporting
During test setup, we used to call a vimscript function(BeforeEachTest) that
attempted to restore Nvim to it's initial state as much as possible in order to
provide a clean environment for running new tests. This approach has proven to
be unreliable, as some tests leave state that can affect other tests, eventually
causing failures that are difficult to debug.

This commit changes the 'clear' function so it will restart Nvim every time it
is called, which is a slower, but more reliable solution that will simplify
spotting bugs in the future.

Some other improvements/fixes were also performed:

- Whenever an error is detected in a handler passed to "run()", the event loop
  will be stopped and the error will be propagated to the main thread.
- Errors and the "cleanup()" function will always send a quit command to the
  current Nvim instance. This should prevent memory starvation when running
  tests under valgrind(where each Nvim instance can consume a lot of memory).
- Fixed a wrong assertion in server_requests_spec.lua. Previously the failure
  was undetected in a notification handler.
- Fixed some tests to expect fully clean registers. The deleted cleanup function
  used to put an empty string in every register, but that resulted in a extra
  line being added.
2014-11-07 00:55:58 -03:00
Thiago de Arruda
d83868fe90 channel: Delay notifications to avoid client race conditions
It is currently possible for a client to send a response that doesn't match the
current server->client request(at the top of the stack). This commit fixes that
by delaying notifications to until the first `channel_send_call` invocation
returns.

Also remove the "call stack" size check, vim will already break if the call
stack goes too deep.
2014-11-06 04:22:06 -03:00
Thiago de Arruda
117d3db6d7 test: Simplify/fix options_spec.lua
The options_spec.lua suite has one purpose: Check if the :options commands will
throw any exception(:options is implemented by $VIMRUNTIME/optwin.vim). For this
it is best to use the `vim_command` API function since it will automatically
catch exceptions and forward them via msgpack-rpc.

Also, the option window seems to affect other tests, so call `restart` in the
teardown hook.
2014-11-06 04:21:57 -03:00
Rainer Borene
a695c87863 legacy tests: migrate test21 2014-11-04 12:57:33 -03:00
Rainer Borene
2d8d4285e4 legacy tests: migrate test7 2014-11-04 12:57:33 -03:00
Rainer Borene
ef08a2c0df legacy tests: migrate test6 2014-11-04 12:57:33 -03:00
Rainer Borene
38bef424a2 legacy tests: migrate test28 2014-11-04 12:57:33 -03:00
Rainer Borene
ca0a55c2a9 legacy tests: migrate test20 2014-11-04 12:57:33 -03:00
Rainer Borene
afe9aa758e legacy tests: migrate test97 2014-11-04 12:57:33 -03:00
Rainer Borene
5ea94e14f0 legacy tests: migrate test46 2014-11-04 12:57:33 -03:00
Rainer Borene
ac52d84f16 legacy tests: migrate test27 2014-11-04 12:57:33 -03:00
Rainer Borene
34cc2b1e33 legacy tests: migrate test54 2014-11-04 12:57:33 -03:00
Rainer Borene
fd503f1432 legacy tests: migrate test41 2014-11-04 12:57:33 -03:00
Rainer Borene
f85051b67e legacy tests: migrate test23 2014-11-04 12:57:33 -03:00
Rainer Borene
ffd5c43e84 legacy tests: migrate test56 2014-11-04 12:57:33 -03:00
Rainer Borene
4873171fc6 legacy tests: migrate test_autoformat_join 2014-11-04 12:57:33 -03:00
Rainer Borene
b67ad4f67f legacy tests: migrate test_changelist 2014-11-04 12:57:33 -03:00
Rainer Borene
4ca353d3bd legacy tests: migrate test81 2014-11-04 12:57:33 -03:00
Rainer Borene
79cd4a98ec legacy tests: migrate test_utf8 2014-11-04 12:57:33 -03:00
Rainer Borene
683b75d052 legacy tests: migrate test_insertcount 2014-11-04 12:57:33 -03:00
Rainer Borene
5b7d9bbd08 legacy tests: migrate test_options 2014-11-04 12:57:32 -03:00
Rainer Borene
b33c92439b legacy tests: migrate test18 2014-11-04 12:57:32 -03:00
Rainer Borene
481c449c72 legacy tests: migrate test106 2014-11-04 12:57:32 -03:00
Rainer Borene
6c90902c7a legacy tests: migrate test22 2014-11-04 12:57:32 -03:00
Rainer Borene
b780e946d5 legacy tests: migrate test9 2014-11-04 12:57:32 -03:00
Rainer Borene
d4f92e521c legacy tests: migrate test102 2014-11-04 12:57:32 -03:00
Rainer Borene
dbc7a8d987 legacy tests: migrate test4 2014-11-04 12:57:32 -03:00
Rainer Borene
649aeceb38 legacy tests: improvements to functional helpers.lua
- Clean vim registers and functions before each test
- Add eval workaround to the request helper method
- Export dedent method
2014-11-04 12:57:32 -03:00
Björn Linse
d6da424758 test/api: add test for set_cursor always updating the screen 2014-11-01 12:05:36 +01:00
Stefan Hoffmann
972fc30599 unittest: increase number of retries in cimport 2014-10-30 19:05:39 +01:00
Stefan Hoffmann
741cb5be08 unittest: fix handling of pragma pack in cimport 2014-10-30 19:05:39 +01:00
Justin M. Keyes
49d5ed5591 fix #1027: :wundo segfault in new, non-empty buffer 2014-10-26 20:03:02 +00:00
Kartik K. Agaram
250298884b fix 'sign unplace id'
Since the introduction of the FOR_ALL_BUFFERS macro, 'sign unplace id'
without a buffer was only removing the sign from the first buffer rather
than all buffers, as described in the documentation.

  :help sign-unplace

--

modeline discussion: https://github.com/akkartik/neovim/commit/7863c247db#commitcomment-8342590
2014-10-28 23:12:41 -04:00
Scott Prager
7203796c54 test/job: Implement some basic jobs tests. 2014-10-28 14:09:28 -03:00
Scott Prager
860b6f6f05 test/shell: Add failure tests for system(). 2014-10-28 14:09:28 -03:00
Thiago de Arruda
53ce5493fa test: Small fixes and improvements to functional helpers.lua
- Move the cleanup function definition into `restart()` so restart can be
  selectively used as a hook
- Improve error handling: Before this, errors while running the event loop would
  cause busted to get stuck. Now the error is properly raised by stopping the
  event loop first.
2014-10-28 09:11:40 -03:00
Thiago de Arruda
d696fa51f8 test: verify that msgpacks-rpc exceptions are working 2014-10-23 21:46:09 -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
Nate Sullivan
d11fd1950f legacy tests: migrate test35. #1318
Migrate vim's integration test 35 (increment/decrement commands) to
lua/busted.
2014-10-22 15:28:26 -04: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
0c2ec77ae0 test: Use lua to perform sanity API checks
Sanity API checks made by the python-client in the api-python travis target were
converted to lua and will now live in this repository. This will simplify
performing breaking changes to the API as it won't be necessary to send parallel
PRs the python-client.
2014-10-16 14:06:54 -03:00
Thiago de Arruda
69561ea922 test: Remove run-functional-tests.py
Now that the lua client is available, python/lupa are no longer necessary to run
the functional tests. The helper functions previously defined in
run-functional-tests.py were adapted to test/functional/helpers.lua.
2014-10-16 09:21:37 -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
Thiago de Arruda
f6a008a182 test: Add 'eval' functional helper
The eval helper transforms vimL expressions into lua tables, it's useful for
verifying function output.
2014-10-01 09:31:57 -03:00
Thiago de Arruda
549fc9548d test: Move 'test/legacy' to 'test/functional'
Busted can only discover tests from a single directory. In order to allow tests
under 'legacy' to run as a functional test, it needed to be moved to
'test/functional'.
2014-10-01 09:05:28 -03:00
Thiago de Arruda
42d5b526b9 test: Replace vroom by lua/busted for functional tests
The 'lupa' python package provides a simple way to seamless integrate lua and
python code.

This commit replaces vroom by a python script that exposes the 'neovim' package
to a lua state, and invokes busted to run functional tests. This is a temporary
solution that will enable writing functional tests using lua/bused while a lua
client library is not available.

The reason for dropping vroom is flexibility: Lua/busted has a nice DSL-style
syntax while also providing the customization power of a full programming
language. Another reason is to use a single framework for unit/functional tests.

Two other changes were performed in this commit:

- Instead of "gcc-unittest/gcc-ia32", the travis builds for gcc are now
  identified by "gcc/gcc-32". They will run unit/functional tests for both 64
  and 32 bits.
- Old integration tests(in src/nvim/testdir) are now ran by the 'oldtest' target
2014-09-30 17:37:16 -03:00
Scott Prager
8b3e5829e4 update os_can_exe unit test 2014-09-17 01:01:25 -04:00
Scott Prager
9445eaa297 vim-patch:7.4.235
Problem:    It is not easy to get the full path of a command.
Solution:   Add the exepath() function.

https://code.google.com/p/vim/source/detail?r=5ab2946f7ce560985830fbc3c453bb0f7a01f385
2014-09-17 01:00:24 -04:00
Justin M. Keyes
99a9161bac unit tests: initialize everything 2014-09-11 08:58:17 +00:00
Justin M. Keyes
f6088e79b0 unit tests: avoid global scope; add missing cimports
temporarily comment out call to vim_deltempdir() to avoid segfault
2014-09-11 05:17:52 +00:00
Justin M. Keyes
c76feb338a unit tests: helpers.lua: hack to avoid empty popen() result 2014-09-11 05:17:52 +00:00
Stefan Hoffmann
10813ce38c fileid: rename os_file_id_equal_file_info 2014-08-31 15:47:43 +02:00
Stefan Hoffmann
3cf7a17a44 fileid: rename os_file_id_equal 2014-08-31 15:47:36 +02:00
Stefan Hoffmann
4e43095ab2 fileid: rename os_get_file_id 2014-08-31 15:43:40 +02:00
Stefan Hoffmann
8a66f4f245 fileinfo: rename os_file_info_get_inode 2014-08-31 15:42:19 +02:00
Stefan Hoffmann
6e3dce144a fileinfo: rename os_file_info_get_id 2014-08-31 15:41:03 +02:00
Stefan Hoffmann
edcc1a9732 fileinfo: rename os_file_info_id_equal 2014-08-31 15:39:33 +02:00
Stefan Hoffmann
5d074a0aa6 fileinfo: rename os_get_file_info{,_link,_fd} 2014-08-31 15:37:55 +02:00
Stefan Hoffmann
9ee1c3604c fileinfo: implement os_fileinfo_blocksize 2014-08-31 15:33:23 +02:00
Stefan Hoffmann
e85fe0957d fileinfo: implement os_fileinfo_hardlinks 2014-08-31 15:22:38 +02:00
Stefan Hoffmann
aa378acdf5 fileinfo: implement os_fileinfo_size
this replaces os_get_file_size and file_info.stat.st_size
2014-08-31 15:15:02 +02:00
Stefan Hoffmann
c798611771 unittest: Move FileInfo tests one level up 2014-08-31 14:50:50 +02:00
Thiago de Arruda
7b41fb383a unittest: Remove remaining moonscript references 2014-08-31 14:50:49 +02:00
Thiago de Arruda
38b7b4405e unittest: convert set.moon to lua 2014-08-31 14:50:49 +02:00
Thiago de Arruda
3a951112c0 unittest: convert preprocess.moon to lua 2014-08-31 14:50:49 +02:00
Thiago de Arruda
d74ae5be9d unittest: convert users_spec.moon to lua 2014-08-31 14:50:49 +02:00
Thiago de Arruda
df50d242f5 unittest: convert path_spec.moon to lua 2014-08-31 14:50:49 +02:00
Thiago de Arruda
227e38f0c6 unittest: convert fs_spec.moon to lua 2014-08-31 14:50:49 +02:00
Thiago de Arruda
d39aa51e94 unittest: convert env_spec.moon to lua 2014-08-31 14:50:49 +02:00
Thiago de Arruda
dcda179e6a unittest: convert helpers.moon to lua 2014-08-31 14:50:49 +02:00
Thiago de Arruda
097ff4b8b2 unittest: convert garray_spec.moon to lua 2014-08-31 14:50:49 +02:00
Scott Prager
b9553bd038 path.c: Learn invocation_path_tail().
Required for vim patch 276 as an alternative to
`get_isolated_shell_name()`.
2014-08-17 22:16:00 -04:00
Pavel Platto
1a361b629a os_fchown: enable 'change group' unittest on Travis-CI
Add section `before_install` in `.travis.yml` to create test group and
add current user to this group.
It is needed because by default user on Travis-CI belongs only to one
primary group derived from that user. So we have no alternative to
change group of the file.
2014-08-13 09:36:09 +03:00
Pavel Platto
64ea24bc17 os_fchown: add unit tests 2014-08-13 09:13:59 +03:00
Thiago de Arruda
353bb20ff7 build/test: setup functional tests using vroom 2014-08-09 15:10:56 -03:00
Scott Prager
c3b9f863ea Units: Move NULL, OK, and FAIL to helpers.moon. #982 2014-07-30 18:25:43 -04:00
Nicolas Hillegeer
974752c53b test/shell: add tests
- The calls to (partially) initialize logging
  need to go. Blocked on #981.
2014-07-27 14:00:45 -03:00
Nicolas Hillegeer
1cfc468e5c test/helpers: allow interning Pascal strings
os_system() returns a Pascal string, for example (it also NUL-terminates the
string, but that's neither here nor there).
2014-07-27 14:00:45 -03:00
Nicolas Hillegeer
ad4c1e1954 test/formatc: improve standalone usage
Easier testing.
2014-07-27 14:00:44 -03:00
Nicolas Hillegeer
10479fd233 test/formatc: improve 'inline' function handling
Apple seems to define some functions as `inline` but not `static` in
headers. The ghetto parser wasn't unbelievably happy with this.
2014-07-27 14:00:44 -03:00
Wayne Rowcliffe
7a2ea275eb Add tests for buffer.c and fileio.c 2014-07-22 05:28:17 -05:00
Wayne Rowcliffe
9453b7230b Statically allocate NameBuff 2014-07-22 05:28:17 -05:00
Nicolas Hillegeer
06ca70b191 test/fs: move tests of path_full_dir_name to path
Move tests of path_full_dir_name to path_spec. It is only defined in path.h.
Not sure why this works most of the time (I can only trigger a failure when
running under lldb).

It's a more logical place to have the test as well.
2014-07-16 19:05:35 +02:00
Nicolas Hillegeer
c376cf46bf test/helpers: add 'vim_init' helper
- Initializes some global variables.
- Necessary for the buffer tests in PR #904.
2014-07-16 19:05:35 +02:00
Nicolas Hillegeer
109c70dc60 test/preprocess: always declare EXTERN
Unit tests never need to declare globals, only access them. In the main code
base this is handled by including "vim.h". If a file wants to declare
globals (in the case of neovim that's only main.c), it #define's EXTERN and
includes "vim.h". Otherwise, a file just includes "vim.h" (that's the
majority case). Since we want to be able to run unit tests without including
"vim.h", we predefine "EXTERN" to mean extern. That way, we don't have to
include "vim.h".
2014-07-16 19:05:35 +02:00
Nicolas Hillegeer
6d0f9417ec profiling: add tests
Some functions are missing:

- profile_self
- profile_get_wait
- profile_set_wait
- profile_sub_wait
2014-07-16 17:12:35 +02:00
Pavel Platto
790d81582c tempfile.c: add tests 2014-07-14 21:14:40 +02:00
Pavel Platto
2dc69700ec Use default busted pattern for unittests #943
- Unittest should contain substring '_spec' in filename.
- This is the simplest way to use both lua and moonscript tests.
- This prevents running of non-test scripts from test folder.
2014-07-14 20:08:39 +02:00
Justin M. Keyes
0ceebc2c91 os_open: add unit tests 2014-07-14 09:05:52 -04:00
Stefan Hoffmann
4a22fb06b9 FileID: implement FileID struct
`FileID` should encapsulate `st_dev` and `st_ino`. It is a new abstraction
used to check if two files are the same. `FileID`s will be embeded inside
other struts like `buf_t` or `ff_visited_T`, where a full `FileInfo` would be
to big.
2014-06-27 13:59:28 +02:00
Will Stamper
5b3b3fd3ed spelling fixes #827 2014-06-12 20:26:35 -04:00
ZyX
70929f7e16 Add automatic generation of headers
- The 'stripdecls.py' script replaces declarations in all headers by includes to
  generated headers.
  `ag '#\s*if(?!ndef NEOVIM_).*((?!#\s*endif).*\n)*#ifdef INCLUDE_GENERATED'`
  was used for this.
- Add and integrate gendeclarations.lua into the build system to generate the
  required includes.
- Add -Wno-unused-function
- Made a bunch of old-style definitions ANSI

This adds a requirement: all type and structure definitions must be present
before INCLUDE_GENERATED_DECLARATIONS-protected include.

Warning: mch_expandpath (path.h.generated.h) was moved manually. So far it is
the only exception.
2014-06-02 11:04:17 -03:00
Eliseo Martínez
74b9396043 Introduce nvim namespace: Fix unit tests.
Point cimports to new locations.
2014-05-15 20:46:02 +02:00
Stefan Hoffmann
aff9673076 implemented FileInfo struct
This struct is a wrapper around `uv_stat_t` to hide the stat information
inside `src/os/`.
The stat file attribute will be private after all refactorings concerning
file informations are done.
2014-05-09 15:49:33 +02:00
Thomas Wienecke
d84fe0a1b0 Fix unit test cleanup of path_shorten_fname_if_possible. 2014-05-03 14:16:55 -04:00
John Szakmeister
7cb20fd1b0 Generate a lua module to help pass build-related settings.
This allows us to avoid hard-coding paths and using environment
variables to communicate key information to unit tests, which fits
with the overall goal of making sure that folks driving CMake directly
can continue to do out-of-tree builds.
2014-05-03 10:36:54 -04:00
Nicolas Hillegeer
b737b27e6a garray: add unit tests for ga_concat_strings_sep 2014-04-29 09:29:10 -03:00
Nicolas Hillegeer
ce9c49f222 garray: add unit tests
Only append_ga_line() was not tested because it relies on global vim state.
2014-04-29 09:29:10 -03:00
John
42efbfd2fd Test and refactor shorten_fname and shorten_fname1
Rename `shorten_fname` -> `path_shorten_fname`
Rename `shorten_fname1` -> `path_shorten_fname_if_possible`
2014-04-29 09:24:34 -03:00
Nicolas Hillegeer
9e04e81ac7 test: no longer define ad-hoc C headers
With the improved cimport helper, we can just load what we want.
2014-04-28 16:17:25 -03:00
Nicolas Hillegeer
d699ccfb0c test: fix the cimport method
This commit will hopefully allow the cimport method to be used just as one
would use #inclue <header.h> in C. It follows the following method:

1. create a pseudoheader file that #include's all the requested header files
2. runs the pseudoheader through the C preprocessor (it will try various
   compilers if available on the system).
3. runs the preprocessed file through a C formatter, which attempts to group
   statements on one line. For example, a struct definition that was
   formerly on several lines will take just one line after formatting. This
   is done so that unique declarations can be detected. Duplicates are thus
   easy to remove.
4. remove lines that are too complex for the LuaJIT C parser (such as:
   Objective-C block syntax, crazy enums defined on linux, ...)
5. remove duplicate declarations
6. pass result to ffi.cdef
2014-04-28 16:17:25 -03:00
Stefan Hoffmann
445f31f076 port vim_mkdir, mch_rmdir and mch_remove to libuv 2014-04-11 13:31:48 -03:00
John Schmidt
2a0c6ff3ef Fix broken build due to unit test include order
Commit 4348d1e6f7
 introduced a bug that breaks the unit tests unless
 they run in a certain order. Both path.moon
 and os/fs.moon tries to include the same Enum, which
 fails since ffi.cdef can only include definitions once.

 This solves the bug by using Lua variables instead of
 ffi.cdef Enums.
2014-04-09 17:17:26 -03:00
John Schmidt
ac62041138 Move exe functions back to os/fs.c 2014-04-08 21:56:05 -03:00
John Schmidt
6fb58d1c5c Change prefix from os_* to path_* 2014-04-08 21:56:05 -03:00
John
aa7218b646 Move and adapt os_get_absolute_path unit tests to vim_FullName
* Add two new unit tests to `vim_FullName`
* Make `os_get_absolute_path` static
2014-04-08 21:56:05 -03:00
John Schmidt
4348d1e6f7 Move functions from os/fs.c into path.c
Move unit tests from os/fs.moon to path.moon
2014-04-08 21:56:05 -03:00
Hinidu
8a2ffb2b01 Use stdbool in os module 2014-04-07 12:15:28 -03:00
Stefan Hoffmann
e76249c813 Moved mch_get_host_name and renamed it to os_get_hostanme 2014-04-05 20:19:38 -03:00
Stefan Hoffmann
a8013f2bb1 Moved mch_get_pid and renamed it to os_get_pid 2014-04-05 20:19:38 -03:00
Hinidu
a3ff83ce7e Replace mch_rename and vim_rename with libuv 2014-04-04 16:03:55 -03:00
Thomas Wienecke
bfa4490aac Rename FPC_* constants. 2014-04-03 10:32:41 -03:00
Thomas Wienecke
865e3280a8 Fix seperator->separator, path_tail_with_separator->path_tail_with_sep. 2014-04-03 10:32:41 -03:00
Thomas Wienecke
955d6a2949 Test and refactor getnextcomp -> path_next_component. 2014-04-03 10:32:41 -03:00
Thomas Wienecke
7021b970b9 Test and refactor gettail_sep -> path_tail_with_seperator. 2014-04-03 10:32:41 -03:00
Thomas Wienecke
77bfb6cd99 Test and refactor gettail -> path_tail. 2014-04-03 10:32:41 -03:00
Thomas Wienecke
6d712defa5 Refactor fullpathcmp -> path_full_compare. 2014-04-03 10:32:41 -03:00
Thomas Wienecke
98b1f73c3f Make FPC_* defines an enum type in path.h. 2014-04-03 10:32:41 -03:00
Stefan Hoffmann
f762a9e195 move filewritable() into /src/os/fs.c and rename it 2014-04-03 10:30:03 -03:00
Stefan Hoffmann
071d28076f move check_file_readonly() into /src/os/fs.c and rename it 2014-04-03 10:30:03 -03:00
Thomas Wienecke
f9d4b14f25 Delete os_delay unit test. 2014-04-02 18:50:09 -03:00
Thomas Wienecke
4e29a820b6 Address clint warnings and other style issues.
* Add const.
* Fix conditions (move && from end to start of line).
* Use int32_t instead of long.
* Use //-style comments.
2014-03-27 19:57:55 -03:00
Thomas Wienecke
5762c4e528 Rename mch_* functions to os_* in os module. 2014-03-27 19:57:55 -03:00
Stefan Hoffmann
7d413050ba fix mch_delay() unittest 2014-03-25 15:41:15 +01:00
Thiago de Arruda
32f118a47f Implement mch_delay on top of libuv
Needed to temporarily move two static variables from os_unix.c to 'globals.h'
as those are shared by other functions still in os_unix.
2014-03-24 19:25:07 -03:00
John Szakmeister
0b2f6a0cf4 Revamp the build system.
This achieves several goals:

 * Less reliance on scripts so we have better portability to Windows
   (though we still have a ways to go for proper Windows support).
   Luajit, luarocks, moonscript, and busted are all installed via CMake
   now.
 * Trying to make use of pkg-config to get the correct libraries.  The
   latest libuv is still broken in this regard, but we'll at least be in
   a position to use it.
 * Allow the use of Ninja or make.  The former runs faster in many
   environments, and automatically makes use of parallel builds.

This also allows for system installed dependencies--though not through
the Makefile just yet--and adds support for FreeBSD.

This also make us build libuv and luajit as static libraries only, since
we're only concerned about having static libraries for our bundled
dependencies.
2014-03-21 15:22:00 -04:00
Thomas Wienecke
1949acc806 Revive vim_fname (-> os_file_exists); fix misuse of mch_getperm.
* Move vim_fname from misc1 to os/fs:os_file_exists.
* Add unit tests for os_file_exists.
* Replace misuse of mch_getperm with os_file_exists.
2014-03-15 11:50:22 -03:00
Thomas Wienecke
1f578ec5a1 Add unit tests for mch_[gs]etperm.
Use preprocessor trick proposed by @mahkoh to import 'defines' like
S_IRUSR.
2014-03-15 11:50:22 -03:00
Stefan Hoffmann
33eb031c01 refactored part of expand_env_esc() into mch_get_user_directory() 2014-03-13 17:18:44 -03:00
Stefan Hoffmann
ce31410c79 moved mch_get_user_name() and mch_get_uname() into os/users.c 2014-03-13 17:18:44 -03:00
Stefan Hoffmann
6fd9f090fc refactored logic from init_users() into mch_get_usernames() 2014-03-13 17:18:43 -03:00
Thomas Wienecke
ab0c96187c Fix bugs, clean code, add tests.
* Add const specifiers, update comments, add assert.
* Move os_unix.moon tests to os/fs.moon + clean tests.
* Add uv_fs_req_cleanup call.
* Add tests with absolute paths to mch_isdir.
* Add to_cstr to test/unit/helpers.moon and fix respective unit tests.
2014-03-07 17:30:39 -03:00
Thomas Wienecke
ef03a8c52a Declare is_executable as static and remove its unit tests.
Testing the public interface mch_can_exe should suffice. Every former
test of is_executable has a counterpart in the tests of mch_can_exe.
Thus we can keep private things private.
2014-03-07 17:30:39 -03:00
Thomas Wienecke
d5b223afe2 Move mch_can_exe, executable_file to os/fs.c.
* Rename executable_file to is_executable.
2014-03-07 17:30:39 -03:00
Thomas Wienecke
1468c12fd1 Add another unit test to mch_can_exe. 2014-03-07 17:30:39 -03:00
Stefan Hoffmann
f2433aedc8 cleanup environment variable handling + unit tests
* removed a putenv() implementation which isn't needed anymore
  * mch_getenv() and mch_setenv() are now functions in src/os/env.c
  * removes direct calls to getenv() and setenv() outside of src/os/env.c
  * refactored the logic of get_env_name into mch_getenvname_at_index
  * added unittests for the functions in os/env.c
2014-03-06 13:38:45 -03:00
Thomas Wienecke
fc86866402 Fix style issues.
* Rename mch_full_name to mch_get_absolute_path.
* Rename mch_is_full_name to mch_is_absolute_path.
* Add a lot of missing parentheses.
* Remove yoda-conditions for consistency.
* Remove spaces in function declaration.
2014-03-06 13:10:58 -03:00
Thomas Wienecke
fafdad2f95 Implement pending test. 2014-03-05 15:01:19 -03:00
Thomas Wienecke
8bb672e6a0 Port mch_isdir to libuv. 2014-03-05 15:01:19 -03:00
Thomas Wienecke
1e5a6acebd Add unit tests for executable_file and mch_can_exe.
Caution: There is a pending test which should be implemented.
2014-03-05 15:01:19 -03:00
Thomas Wienecke
c6917641c2 Add unit tests for mch_isdir. 2014-03-05 15:01:19 -03:00
Thiago de Arruda
34538a82f3 Apply small refactor to unit tests
Redefine macro constants as enums in the ffi and import those in their
respective test modules.
2014-03-04 11:26:37 -03:00
Thomas Wienecke
0677e0ee9c Correct a few parentheses. 2014-03-04 06:54:08 -03:00
Thomas Wienecke
92a0374d7b Rename and refactor mch_FullName.
* Rename mch_FullName to mch_full_name to match the style guide.
* Add mch_full_dir_name, which saves the absolute path of a given
directory relative to cwd into a given buffer.
* Add function append_path, which glues together two given paths with a
slash.
* Adapt moonscript coding style to the tests.
2014-03-04 06:54:08 -03:00
Thomas Wienecke
fcbfd57d1f Add unit tests for ported filesystem functions. 2014-03-03 08:54:02 -03:00
Thiago de Arruda
fd448123aa Add more example unit tests and run with travis 2014-02-27 18:31:45 -03:00
Thiago de Arruda
d04ca90f5c Add basic infrastructure for unit testing
Tests will be written using the [moonscript](http://moonscript.org/) language,
a lua 'dialect' that is whitespace-significant and has a syntax similar to
coffeescript. The test framework used is [busted](http://olivinelabs.com/busted/),
a bdd framework for lua/moonscript.

Luajit has a nice ffi module, which lets lua programs link shared libraries and
call it's functions without writing any C code.

To take advantage of this fact for testing C functions, a new target was added
to CMakeLists.txt, which compiles neovim as a shared library that is loaded by
the process running the tests.

This commit adds necessary code for downloading and installing a lua package
manager(luarocks) locally. It wasn't added as a subtree because there are quite
a few blobs in its source tree.
2014-02-27 17:55:10 -03:00