diff options
-rw-r--r-- | Makefile | 2 | ||||
-rwxr-xr-x | scripts/travis.sh | 1 | ||||
-rw-r--r-- | test/unit/misc1.moon | 19 |
3 files changed, 18 insertions, 4 deletions
@@ -36,6 +36,6 @@ clean: install: build/bin/nvim ${MAKE} -C build install -.PHONY: test deps cmake install +.PHONY: test unittest deps cmake install .DEFAULT: build/bin/nvim diff --git a/scripts/travis.sh b/scripts/travis.sh index 260eb3eefe..16dd5686c3 100755 --- a/scripts/travis.sh +++ b/scripts/travis.sh @@ -3,6 +3,7 @@ export VALGRIND_CHECK=1 make cmake CMAKE_EXTRA_FLAGS="-DCMAKE_INSTALL_PREFIX=$PWD/dist" make +make unittest echo "Running tests with valgrind..." if ! make test > /dev/null; then if ls src/testdir/valgrind.* > /dev/null 2>&1; then diff --git a/test/unit/misc1.moon b/test/unit/misc1.moon index dbcd192262..a795b03dd9 100644 --- a/test/unit/misc1.moon +++ b/test/unit/misc1.moon @@ -8,6 +8,7 @@ cstr = ffi.typeof 'char[?]' describe 'misc1 function', -> describe 'fullpathcmp', -> ffi.cdef 'int fullpathcmp(char *s1, char *s2, int checkname);' + fullpathcmp = (s1, s2, cn) -> s1 = cstr (string.len s1) + 1, s1 s2 = cstr (string.len s2) + 1, s2 @@ -15,7 +16,7 @@ describe 'misc1 function', -> f1 = 'f1.o' f2 = 'f2.o' - f3 = 'test/f1.o' + FPC_SAME = 1 FPC_DIFF = 2 FPC_NOTX = 4 @@ -26,13 +27,25 @@ describe 'misc1 function', -> -- create the three files that will be used in this spec (io.open f1, 'w').close! (io.open f2, 'w').close! - (io.open f3, 'w').close! after_each -> os.remove f1 os.remove f2 - os.remove f3 it 'returns FPC_SAME when passed the same file', -> eq FPC_SAME, (fullpathcmp f1, f1) + it 'returns FPC_SAMEX when files that dont exist and have same name', -> + eq FPC_SAMEX, (fullpathcmp 'null.txt', 'null.txt', true) + + it 'returns FPC_NOTX when files that dont exist', -> + eq FPC_NOTX, (fullpathcmp 'null.txt', 'null.txt') + + it 'returns FPC_DIFF when passed different files', -> + eq FPC_DIFF, (fullpathcmp f1, f2) + eq FPC_DIFF, (fullpathcmp f2, f1) + + it 'returns FPC_DIFFX if only one does not exist', -> + eq FPC_DIFFX, (fullpathcmp f1, 'null.txt') + eq FPC_DIFFX, (fullpathcmp 'null.txt', f1) + |