diff options
author | w0rp <devw0rp@gmail.com> | 2017-04-29 18:03:08 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-04-29 18:03:08 +0100 |
commit | 6fc3954bd358e4d3827d7c55bff3102fb48f2e2e (patch) | |
tree | 725e40f56e70a2173b1d7f0023a6f33cea92d313 /test/test_path_equality.vader | |
parent | 0b4acd645395d4196f2e346d65aeddf063927f4e (diff) | |
download | ale-6fc3954bd358e4d3827d7c55bff3102fb48f2e2e.zip |
Cover the new path functions with some tests
Diffstat (limited to 'test/test_path_equality.vader')
-rw-r--r-- | test/test_path_equality.vader | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/test_path_equality.vader b/test/test_path_equality.vader new file mode 100644 index 00000000..b1f06967 --- /dev/null +++ b/test/test_path_equality.vader @@ -0,0 +1,31 @@ +Execute(ale#path#GetAbsPath should handle simple relative paths): + AssertEqual '/foo/bar', ale#path#GetAbsPath('/foo', 'bar') + AssertEqual 'C:\foo/bar', ale#path#GetAbsPath('C:\foo', 'bar') + AssertEqual getcwd() . '/foo/bar', ale#path#GetAbsPath('foo', 'bar') + +Execute(ale#path#GetAbsPath should handle relative paths with dots): + AssertEqual '/foo/baz', ale#path#GetAbsPath('/foo', 'bar/sub/../../baz') + AssertEqual '/foo/baz', ale#path#GetAbsPath('/foo/', 'bar/sub/../../baz') + AssertEqual '/foo/other', ale#path#GetAbsPath('/foo/bar', '../other') + AssertEqual '/foo/other', ale#path#GetAbsPath('/foo/bar/', '../other') + +Execute(ale#path#GetAbsPath should handle absolute paths): + AssertEqual '/foo/bar', ale#path#GetAbsPath('/something else', '/foo/bar') + AssertEqual 'C:\foo/bar', ale#path#GetAbsPath('D:\another thing', 'C:\foo/bar') + +Execute(ale#path#IsBufferPath should match simple relative paths): + silent file! foo.txt + + Assert ale#path#IsBufferPath(bufnr(''), 'foo.txt'), 'No match for foo.txt' + Assert !ale#path#IsBufferPath(bufnr(''), 'bar.txt'), 'Bad match for bar.txt' + +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' + +Execute(ale#path#IsBufferPath should match paths with dots): + silent file! foo.txt + + Assert ale#path#IsBufferPath(bufnr(''), './test/../foo.txt'), 'No match for ./test/../foo.txt' |