summaryrefslogtreecommitdiff
path: root/test/test_path_upwards.vader
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-12-18 13:27:59 +0000
committerw0rp <devw0rp@gmail.com>2017-12-18 13:27:59 +0000
commitfdaac9bd781baf85d04d6b3138a2b80cd7b3a25d (patch)
treec79dc88b5d4a33e273484e6568d674e23bb6a64b /test/test_path_upwards.vader
parent31241e9ed89ddad6c015d0f9ca9bb8a4de80332e (diff)
downloadale-fdaac9bd781baf85d04d6b3138a2b80cd7b3a25d.zip
Fix #1210 - Fix a Windows path issue which broke TSLint
Diffstat (limited to 'test/test_path_upwards.vader')
-rw-r--r--test/test_path_upwards.vader98
1 files changed, 47 insertions, 51 deletions
diff --git a/test/test_path_upwards.vader b/test/test_path_upwards.vader
index 8b81a109..cd461a28 100644
--- a/test/test_path_upwards.vader
+++ b/test/test_path_upwards.vader
@@ -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