Commit Graph

83 Commits

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