1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
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 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')
" 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 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
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 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 CheckPath(getcwd() . '////foo.txt'), 'No match for foo.txt'
Execute(ale#path#IsBufferPath should accept various names for stdin):
Assert ale#path#IsBufferPath(bufnr(''), '-')
Assert ale#path#IsBufferPath(bufnr(''), 'stdin')
Assert ale#path#IsBufferPath(bufnr(''), '<stdin>')
Assert ale#path#IsBufferPath(bufnr(''), '<somethingelse>')
Execute(ale#path#IsBufferPath should match files in /tmp):
call ale#test#SetFilename('app/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
|