install.fairie/dotfiles/.vim/plugged/ale/test/test_path_upwards.vader
Git E2E Dev Test Username e149692cc9 git subrepo clone https://github.com/dense-analysis/ale.git ./dotfiles/.vim/plugged/ale
subrepo:
  subdir:   "dotfiles/.vim/plugged/ale"
  merged:   "e4b205440"
upstream:
  origin:   "https://github.com/dense-analysis/ale.git"
  branch:   "master"
  commit:   "e4b205440"
git-subrepo:
  version:  "0.4.3"
  origin:   "???"
  commit:   "???"
2022-10-18 10:37:09 -04:00

48 lines
1.6 KiB
Text

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
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