mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-06 12:44:23 +08:00
Fix #1210 - Fix a Windows path issue which broke TSLint
This commit is contained in:
@@ -1,52 +1,48 @@
|
||||
After:
|
||||
let g:ale_has_override = {}
|
||||
Execute(ale#path#Upwards should return the correct path components):
|
||||
if has('unix')
|
||||
" Absolute paths should include / on the end.
|
||||
AssertEqual
|
||||
\ ['/foo/bar/baz', '/foo/bar', '/foo', '/'],
|
||||
\ ale#path#Upwards('/foo/bar/baz')
|
||||
AssertEqual
|
||||
\ ['/foo/bar/baz', '/foo/bar', '/foo', '/'],
|
||||
\ ale#path#Upwards('/foo/bar/baz///')
|
||||
" Relative paths do not.
|
||||
AssertEqual
|
||||
\ ['foo/bar/baz', 'foo/bar', 'foo'],
|
||||
\ ale#path#Upwards('foo/bar/baz')
|
||||
AssertEqual
|
||||
\ ['foo2/bar', 'foo2'],
|
||||
\ ale#path#Upwards('foo//..////foo2////bar')
|
||||
" Expect an empty List for empty strings.
|
||||
AssertEqual [], ale#path#Upwards('')
|
||||
endif
|
||||
|
||||
Execute(ale#path#Upwards should return the correct path components for Unix):
|
||||
let g:ale_has_override = {'win32': 0}
|
||||
|
||||
" Absolute paths should include / on the end.
|
||||
AssertEqual
|
||||
\ ['/foo/bar/baz', '/foo/bar', '/foo', '/'],
|
||||
\ ale#path#Upwards('/foo/bar/baz')
|
||||
AssertEqual
|
||||
\ ['/foo/bar/baz', '/foo/bar', '/foo', '/'],
|
||||
\ ale#path#Upwards('/foo/bar/baz///')
|
||||
" Relative paths do not.
|
||||
AssertEqual
|
||||
\ ['foo/bar/baz', 'foo/bar', 'foo'],
|
||||
\ ale#path#Upwards('foo/bar/baz')
|
||||
AssertEqual
|
||||
\ ['foo2/bar', 'foo2'],
|
||||
\ ale#path#Upwards('foo//..////foo2////bar')
|
||||
" Expect an empty List for empty strings.
|
||||
AssertEqual [], ale#path#Upwards('')
|
||||
|
||||
Execute(ale#path#Upwards should return the correct path components for Windows):
|
||||
let g:ale_has_override = {'win32': 1}
|
||||
|
||||
AssertEqual
|
||||
\ ['C:\foo\bar\baz', 'C:\foo\bar', 'C:\foo', 'C:\'],
|
||||
\ ale#path#Upwards('C:\foo\bar\baz')
|
||||
AssertEqual
|
||||
\ ['C:\foo\bar\baz', 'C:\foo\bar', 'C:\foo', 'C:\'],
|
||||
\ ale#path#Upwards('C:\foo\bar\baz\\\')
|
||||
AssertEqual
|
||||
\ ['/foo\bar\baz', '/foo\bar', '/foo', '/'],
|
||||
\ ale#path#Upwards('/foo/bar/baz')
|
||||
AssertEqual
|
||||
\ ['foo\bar\baz', 'foo\bar', 'foo'],
|
||||
\ ale#path#Upwards('foo/bar/baz')
|
||||
AssertEqual
|
||||
\ ['foo\bar\baz', 'foo\bar', 'foo'],
|
||||
\ ale#path#Upwards('foo\bar\baz')
|
||||
" simplify() is used internally, and should sort out \ paths when actually
|
||||
" running Windows, which we can't test here.
|
||||
AssertEqual
|
||||
\ ['foo2\bar', 'foo2'],
|
||||
\ ale#path#Upwards('foo//..///foo2////bar')
|
||||
" Expect an empty List for empty strings.
|
||||
AssertEqual [], ale#path#Upwards('')
|
||||
" Paths starting with // return /
|
||||
AssertEqual
|
||||
\ ['/foo2\bar', '/foo2', '/'],
|
||||
\ ale#path#Upwards('//foo//..///foo2////bar')
|
||||
if has('win32')
|
||||
AssertEqual
|
||||
\ ['C:\foo\bar\baz', 'C:\foo\bar', 'C:\foo', 'C:\'],
|
||||
\ ale#path#Upwards('C:\foo\bar\baz')
|
||||
AssertEqual
|
||||
\ ['C:\foo\bar\baz', 'C:\foo\bar', 'C:\foo', 'C:\'],
|
||||
\ ale#path#Upwards('C:\foo\bar\baz\\\')
|
||||
AssertEqual
|
||||
\ ['/foo\bar\baz', '/foo\bar', '/foo', '/'],
|
||||
\ ale#path#Upwards('/foo/bar/baz')
|
||||
AssertEqual
|
||||
\ ['foo\bar\baz', 'foo\bar', 'foo'],
|
||||
\ ale#path#Upwards('foo/bar/baz')
|
||||
AssertEqual
|
||||
\ ['foo\bar\baz', 'foo\bar', 'foo'],
|
||||
\ ale#path#Upwards('foo\bar\baz')
|
||||
" simplify() is used internally, and should sort out \ paths when actually
|
||||
" running Windows, which we can't test here.
|
||||
AssertEqual
|
||||
\ ['foo2\bar', 'foo2'],
|
||||
\ ale#path#Upwards('foo//..///foo2////bar')
|
||||
" Expect an empty List for empty strings.
|
||||
AssertEqual [], ale#path#Upwards('')
|
||||
" Paths starting with // return /
|
||||
AssertEqual
|
||||
\ ['/foo2\bar', '/foo2', '/'],
|
||||
\ ale#path#Upwards('//foo//..///foo2////bar')
|
||||
endif
|
||||
|
||||
Reference in New Issue
Block a user