summaryrefslogtreecommitdiff
path: root/test/test_path_equality.vader
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2019-06-05 14:16:43 +0100
committerw0rp <devw0rp@gmail.com>2019-06-05 14:16:43 +0100
commit7b78f2b846e2f3443dcb2ceacee54eb99e37f040 (patch)
tree3173fbc32daa56a25fb3de28470fdcaf381e32c0 /test/test_path_equality.vader
parent381fff0e4c0c7c5057ed0d114169fac3a419ff85 (diff)
downloadale-7b78f2b846e2f3443dcb2ceacee54eb99e37f040.zip
Fix #2525 - Convert Windows paths in a Unix environment
Diffstat (limited to 'test/test_path_equality.vader')
-rw-r--r--test/test_path_equality.vader27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/test_path_equality.vader b/test/test_path_equality.vader
index 4ec9bd64..ee6ae2c5 100644
--- a/test/test_path_equality.vader
+++ b/test/test_path_equality.vader
@@ -6,6 +6,22 @@ Before:
After:
delfunction CheckPath
+Execute(ale#path#Simplify should adjust paths correctly):
+ if has('unix')
+ " Multiple slashes should be removed correctly.
+ AssertEqual '/foo/bar/baz', ale#path#Simplify('////foo///bar///baz')
+ " Back slashes should be converted to forward slashes.
+ " This means some valid filenames are adjusted incorrectly, but in practice
+ " no filenames for code should contain back slashes, and adjusting slashes
+ " like this makes ALE work in MSYS.
+ AssertEqual 'foo/bar/baz', ale#path#Simplify('foo\bar\baz')
+ else
+ " Multiple slashes should be removed correctly.
+ AssertEqual '\foo\bar\baz', ale#path#Simplify('\\\foo\bar\baz')
+ " Forward slashes should be replaced with back slashes.
+ AssertEqual 'foo\bar\baz', ale#path#Simplify('foo/bar/baz')
+ endif
+
Execute(ale#path#IsBufferPath should match simple relative paths):
call ale#test#SetFilename('app/foo.txt')
@@ -53,3 +69,14 @@ Execute(ale#path#IsBufferPath should match files in /tmp):
call ale#test#SetFilename('app/test.ts')
Assert ale#path#IsBufferPath(bufnr(''), tempname() . '/test.ts')
+
+Execute(ale#path#IsBufferPath should match Windows paths on Unix):
+ " This test should pass Unix.
+ "
+ " Back slashes in paths should be replaced with forward slashes, even though
+ " back slashes are valid in filenames on Unix.
+ if has('unix')
+ call ale#test#SetFilename('app/foo/test.ts')
+
+ Assert ale#path#IsBufferPath(bufnr(''), 'foo\test.ts')
+ endif