aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2014-02-27 18:31:45 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2014-02-27 18:31:45 -0300
commitfd448123aa747dae519f03cc6625f331746718bc (patch)
tree73a32985968af36de6f00e807de341d466e786f0 /test
parentd04ca90f5c3aca60641b2ee63931d66f593bbbd3 (diff)
downloadrneovim-fd448123aa747dae519f03cc6625f331746718bc.tar.gz
rneovim-fd448123aa747dae519f03cc6625f331746718bc.tar.bz2
rneovim-fd448123aa747dae519f03cc6625f331746718bc.zip
Add more example unit tests and run with travis
Diffstat (limited to 'test')
-rw-r--r--test/unit/misc1.moon19
1 files changed, 16 insertions, 3 deletions
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)
+