Commit Graph

173 Commits

Author SHA1 Message Date
Daniel Xu
5f1a153831 os/fs: Rename os_file_exists to os_path_exists (#4973)
Because the old name did not indicate that the function
would return true on directories as well.
2016-07-06 01:40:25 -04:00
ZyX
142d00e8da unittests/*/helpers: Fix testlint errors 2016-06-24 17:38:33 +03:00
ZyX
2968dc7bdd fixup! unittests: Add tests for vim_to_object function 2016-06-24 16:53:26 +03:00
ZyX
6b06bdafa2 unittests: Add tests for vim_to_object function 2016-06-24 16:53:26 +03:00
ZyX
4741c8b234 unittests: Fix testlint errors 2016-06-24 09:29:51 +03:00
ZyX
6580dfeddd unittests: Fix kFileNoSymlink test on FreeBSD
Actual value on FreeBSD is -31, UV_EMLINK was obtained from
/usr/include/asm-generic/errno-base.h (there EMLINK is defined as 31 there).
This may actually be something else, but I do not think so as “Too many links”
description also fits in. [Man page][1] agrees with me, search for `[EMLINK]`
([linux man page][2] also specifies ELOOP explicitly in a similar section).

[1]: https://www.freebsd.org/cgi/man.cgi?query=open&sektion=2
[2]: http://man7.org/linux/man-pages/man3/open.3p.html
2016-06-24 00:07:57 +03:00
ZyX
a3b05a03b6 unittests: Fix bug somewhere that makes file_read tests SEGV 2016-06-24 00:07:56 +03:00
ZyX
2dd154457c file: Move src/nvim/file.* to src/nvim/os/fileio.* 2016-06-24 00:07:55 +03:00
ZyX
fec7983ecd unittests: Add tests for file.c
Also fixes some errors found.
2016-06-24 00:07:54 +03:00
ZyX
3e7c8e7149 unittests: Add os_write test
New os/fs.c functions are now all tested.
2016-06-23 21:17:51 +03:00
ZyX
2ac5f1138b unittests: Add os_close, os_read and os_readv tests 2016-06-23 21:17:51 +03:00
TJ DeVries
aa22b5fd9a Add new functionality to the = marker in the STL
This new functionality is explained in the documentation.

Also, many tests have been added to the buffer_spec.lua file
2016-06-14 20:10:11 +02:00
ZyX
ff470bb853 functests: Check logs in lua code
It is otherwise impossible to determine which test failed sanitizer/valgrind
check. test/functional/helpers.lua module return was changed so that tests which
do not provide after_each function to get new check will automatically fail.
2016-06-10 21:50:49 +03:00
ZyX
c571e80273 unittests: Also remove event_teardown
`event_teardown` is there from 974752c, by aktau. It was introduced with 
`init_homedir` and `event_init`. Then both were removed by justinmk in 
99a9161bac (`init_homedir`) and 
49c5689f45 (`event_init`), but `event_teardown` 
was not removed. Now this may cause a crash. More details in #4852.

Closes #4852
2016-05-31 15:41:24 +03:00
Justin M. Keyes
748898b4dd Merge pull request #4198 from daynin/string-tests
tests: add tests for vim_strsave_escaped() function
2016-05-29 13:10:26 -04:00
Sergey Golovin
c793423374 add test for vim_strsave_escaped() function 2016-05-29 13:26:39 +03:00
Justin M. Keyes
96f834a842 os_nodetype: Return NODE_NORMAL if os_stat fails.
Conforms to Vim's mch_nodetype. Regression by 7db4a15.
buf_write() expects NODE_WRITABLE for character devices such as
/dev/stderr.

Closes #4772
2016-05-22 15:12:02 -04:00
John Szakmeister
69d1bc1a47 test/functional: clear the temp directory before each tempfile test
It's possible that the first test encounters a temp directory with files
in it, due to a previous test causing the first test to fail.  Instead,
let's clean up before and after the test to make sure the temp area is
pristine before and after the test.
2016-05-06 20:53:53 -04:00
Justin M. Keyes
4682b21ef2 Merge pull request #4654 from KillTheMule/testlint
Satisfy testlint.
2016-05-06 01:13:39 -04:00
KillTheMule
00c35ab3b4 vim-patch:7.4.672
Problem:    When completing a shell command, directories in the current
            directory are not listed.
Solution:   When "." is not in $PATH also look in the current directory for
            directories.

b5971141df

Most of it applied manually.
2016-05-02 21:09:43 +02:00
KillTheMule
360d0513d1 Satisfy testlint.
For that, make luatest ignore the preload.lua files.
2016-04-28 19:30:17 +02:00
Justin M. Keyes
49c5689f45 test/unit: ensure event_init()
Closes #4635
References #4630
References https://github.com/neovim/neovim/pull/4070#discussion_r50626558
2016-04-25 00:42:44 -04:00
Justin M. Keyes
6e5343d230 test: shell_spec: rename variable 2016-04-24 23:58:11 -04:00
Jurica Bradaric
2dfc8de1cf Merge tempfile.c back into fileio.c 2016-04-20 08:25:51 +02:00
ZyX
bda0165514 eval/encode: Make sure that encoder can encode NULL variables
Adds two undocumented v: variables: _null_list and _null_dict because I do not 
know a reproducible way to get such lists (though I think I heard about this) 
and dictionaries (do not remember hearing about them). NULL strings are obtained 
using $XXX_UNEXISTENT_VAR_XXX.

Fixes crash in json_encode($XXX_UNEXISTENT_VAR_XXX). Other added tests worked 
fine before this commit.
2016-04-18 02:48:20 +03:00
ZyX
3e435df42c functests: Replace \xXX escapes with \DDD in lua code 2016-04-18 02:48:20 +03:00
ZyX
d06c2a1b18 eval/decode: Do not overflow when parsing -
Also makes if’s less nested.
2016-04-18 02:48:20 +03:00
ZyX
eb806c9620 eval/decode: Make sure that error messages do not cause overflow 2016-04-18 02:48:20 +03:00
ZyX
52c6cc2189 eval/decode: Make sure that parsing strings does not overflow 2016-04-18 02:48:20 +03:00
ZyX
4eb5d05f01 eval/decode: Avoid overflow when parsing incomplete null/true/false
Note: second test does not crash or produce asan errors, even though it should.
2016-04-18 02:48:20 +03:00
ZyX
77776b09c6 eval/encode: Fix writing strings starting with NL to list
Error [found][1] by oni-link.

[1]: https://github.com/neovim/neovim/pull/4131/files#r52239384
2016-04-18 02:47:13 +03:00
oni-link
cd00aa6ae4 mbyte_spec.lua: Fix indentation 2016-04-17 21:07:42 +02:00
oni-link
a8fec15899 mbyte_spec.lua: Fix wording 2016-04-17 21:07:22 +02:00
oni-link
cfe4352897 mbyte.c: Unittest for utfc_ptr2char_len() 2016-04-15 21:17:33 +02:00
Charles Joachim
55844eee10 buffer.c: change return type to bool
Co-authored-by: Wayne Rowcliffe (@war1025)
2016-04-03 15:39:33 -04:00
Marco Hinz
3d15cab29d Tests: fix according to lualint 2016-02-02 20:23:12 +01:00
Seth Jackson
a7ade5c832 misc: UNIX => Unix #4022
Although UNIX is a registered trademark of The Open Group, it doesn't
really matter whether we refer to these systems as UNIX, Unix, or
Unix-like. So, for consistency, refer to them collectively as Unix.

Related:
http://www.greens.org/about/unix.html
http://www.unixica.com/html/unixunix.html
2016-01-16 18:34:31 -05:00
Michael Reed
729064af5f test: sys/fcntl.h -> fcntl.h
POSIX.1-2008[1] says that the latter should be used, and all of our
supported platforms would seem to support this scheme, apparently even
Windows[2].

[1]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/fcntl.h.html
[2]: https://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx
2016-01-14 23:36:58 -05:00
ZyX
3b7c4093e2 shell: Unquote &shell* options before using them 2016-01-11 05:24:44 +03:00
Rui Abreu Ferreira
28e59cb223 Use libuv errors instead of errno in unit tests
Replaced old unit tests for errno with libuv error codes UV_ENOENT
and UV_EEXIST (for os_open and os_getperms).

Added libuv include path to test/includes compiler calls - needed
to get hold of libuv headers.
2015-11-25 23:16:37 +00:00
Marco Hinz
32ecd75a16 test/unit: clean up according to luacheck 2015-11-23 13:57:21 +01:00
Wayne Rowcliffe
70f6b0f338 Start adding unit tests 2015-11-11 21:19:52 -06:00
ZyX
fefcc01cc1 os/fs: Allow os_mkdir_recurse directory name to end with /// 2015-10-23 14:54:11 +03:00
Russ Adams
7be75a0291 test: os_system: spec for non-zero exit. #3419 2015-10-04 22:57:21 -04:00
Thiago de Arruda
c708061a5a os/path: Fix path_get_absolute_path for top-level paths
Close #2833
2015-09-18 14:35:26 -03:00
Justin M. Keyes
8f09fa1a49 os/fs.c: remove os_file_is_readonly()
os_file_is_readonly() in its current form is equivalent to
!os_file_is_writable(). This does not appear to be a bug, because Vim's
use of check_file_readonly() (which we changed to os_file_is_readonly())
is equivalent to !os_file_is_writable() in every case.

os_file_is_readonly() also fails this test:

    returns false if the file is non-read, non-write

A more useful form would define behavior under these cases:

  - path is executable (but not writable)
  - path is non-existent
  - path is directory

But there is no reason for os_file_is_readonly() to exist, so remove it.
2015-08-17 01:15:04 -04:00
Justin M. Keyes
d5cd15e67f test: more cases for os_file_is_readonly() 2015-08-17 01:14:13 -04:00
Justin M. Keyes
ad6b356119 test: cover os_file_is_readable() 2015-08-17 01:07:48 -04:00
Thiago de Arruda
a6e0d35d2d queue: Implement a more flexible event queue 2015-08-13 08:46:21 -03:00
Justin M. Keyes
5c1dc0fbe7 test: fix pending() invocations
AFAICT busted does not report pending() invocations without the 2nd
argument.
2015-08-09 22:33:28 -04:00