summaryrefslogtreecommitdiff
path: root/test/test_path_equality.vader
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-09-11 00:47:27 +0100
committerw0rp <devw0rp@gmail.com>2017-09-11 00:47:27 +0100
commitb6a487ccf9318e449a85bd5b43d7a81b9d17d2be (patch)
tree3fc370f84a5295994d38b54d2eef2468a1a0a9e2 /test/test_path_equality.vader
parentcb8a140141d6365f48e66dfaaaa8f9957f0dc832 (diff)
downloadale-b6a487ccf9318e449a85bd5b43d7a81b9d17d2be.zip
Fix some random test issues for Windows
Diffstat (limited to 'test/test_path_equality.vader')
-rw-r--r--test/test_path_equality.vader38
1 files changed, 27 insertions, 11 deletions
diff --git a/test/test_path_equality.vader b/test/test_path_equality.vader
index 54d9bf9a..c17f0010 100644
--- a/test/test_path_equality.vader
+++ b/test/test_path_equality.vader
@@ -1,34 +1,47 @@
+Before:
+ function! CheckPath(path) abort
+ return ale#path#IsBufferPath(bufnr(''), ale#path#Winify(a:path))
+ endfunction
+
+After:
+ delfunction CheckPath
+
Execute(ale#path#IsBufferPath should match simple relative paths):
call ale#test#SetFilename('app/foo.txt')
- Assert ale#path#IsBufferPath(bufnr(''), 'app/foo.txt'), 'No match for foo.txt'
- Assert !ale#path#IsBufferPath(bufnr(''), 'app/bar.txt'), 'Bad match for bar.txt'
+ Assert CheckPath('app/foo.txt'), 'No match for foo.txt'
+ Assert !CheckPath('app/bar.txt'), 'Bad match for bar.txt'
Execute(ale#path#IsBufferPath should match relative paths with dots):
call ale#test#SetFilename('app/foo.txt')
- Assert ale#path#IsBufferPath(bufnr(''), '../../app/foo.txt'), 'No match for ../../app/foo.txt'
+ " Skip these checks on Windows.
+ if !has('win32')
+ Assert CheckPath('../../app/foo.txt'), 'No match for ../../app/foo.txt'
+ endif
Execute(ale#path#IsBufferPath should match absolute paths):
silent file! foo.txt
- Assert ale#path#IsBufferPath(bufnr(''), getcwd() . '/foo.txt'), 'No match for foo.txt'
- Assert !ale#path#IsBufferPath(bufnr(''), getcwd() . '/bar.txt'), 'Bad match for bar.txt'
+ Assert CheckPath(getcwd() . '/foo.txt'), 'No match for foo.txt'
+ Assert !CheckPath(getcwd() . '/bar.txt'), 'Bad match for bar.txt'
Execute(ale#path#IsBufferPath should match paths beginning with ./):
silent file! foo.txt
- Assert ale#path#IsBufferPath(bufnr(''), './foo.txt'), 'No match for ./foo.txt'
+ if !has('win32')
+ Assert ale#path#IsBufferPath(bufnr(''), './foo.txt'), 'No match for ./foo.txt'
+ endif
Execute(ale#path#IsBufferPath should match if our path ends with the test path):
silent file! foo/bar/baz.txt
- Assert ale#path#IsBufferPath(bufnr(''), 'bar/baz.txt'), 'No match for bar/baz.txt'
+ Assert CheckPath('bar/baz.txt'), 'No match for bar/baz.txt'
Execute(ale#path#IsBufferPath should match paths with redundant slashes):
silent file! foo.txt
- Assert ale#path#IsBufferPath(bufnr(''), getcwd() . '////foo.txt'), 'No match for foo.txt'
+ Assert CheckPath(getcwd() . '////foo.txt'), 'No match for foo.txt'
Execute(ale#path#IsBufferPath should accept various names for stdin):
Assert ale#path#IsBufferPath(bufnr(''), '-')
@@ -39,6 +52,9 @@ Execute(ale#path#IsBufferPath should accept various names for stdin):
Execute(ale#path#IsBufferPath should match files in /tmp):
call ale#test#SetFilename('app/test.ts')
- Assert ale#path#IsBufferPath(bufnr(''), '../../../../../../../../tmp/vG0hKyD/1/test.ts')
- Assert ale#path#IsBufferPath(bufnr(''), '/tmp/vG0hKyD/1/test.ts')
- Assert ale#path#IsBufferPath(bufnr(''), '/run/user/1000/vG0hKyD/1/test.ts')
+ " Skip these checks on Windows.
+ if !has('win32')
+ Assert ale#path#IsBufferPath(bufnr(''), '../../../../../../../../tmp/vG0hKyD/1/test.ts')
+ Assert ale#path#IsBufferPath(bufnr(''), '/tmp/vG0hKyD/1/test.ts')
+ Assert ale#path#IsBufferPath(bufnr(''), '/run/user/1000/vG0hKyD/1/test.ts')
+ endif