summaryrefslogtreecommitdiff
path: root/test/test_path_equality.vader
blob: b1f06967309eba4bdc0edfa85fe873cda8c5aabe (plain)
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
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'