2018-06-20 20:44:08 +08:00
|
|
|
Execute ( SpaceVim api: file ):
|
|
|
|
let &encoding = 'utf-8'
|
|
|
|
let g:spacevim_filetype_icons = {}
|
|
|
|
let file = SpaceVim#api#import('file')
|
|
|
|
AssertEqual file.fticon('foo.md'), ''
|
2020-09-03 23:58:50 +08:00
|
|
|
let path = fnamemodify('.SpaceVim.d/init.vim', ':p')
|
|
|
|
AssertEqual file.unify_path(file.findfile('README.md', fnamemodify(path, ':p')), ':.'), '.SpaceVim.d/README.md'
|
|
|
|
AssertEqual map(file.findfile('README.md', fnamemodify(path, ':p'), 0), 'file.unify_path(v:val, ":.")'), ['.SpaceVim.d/README.md', 'README.md']
|
|
|
|
AssertEqual file.unify_path(file.findfile('README.md', fnamemodify(path, ':p'), 1), ':.'), '.SpaceVim.d/README.md'
|
|
|
|
AssertEqual file.unify_path(file.findfile('README.md', fnamemodify(path, ':p'), -1), ':.'), 'README.md'
|
|
|
|
AssertEqual file.unify_path(file.findfile('README.md', fnamemodify(path, ':p'), -2), ':.'), '.SpaceVim.d/README.md'
|
|
|
|
let path = fnamemodify('bundle/dein.vim/autoload/dein.vim', ':p')
|
|
|
|
AssertEqual file.unify_path(file.finddir('doc/', fnamemodify(path, ':p')), ':.'), 'bundle/dein.vim/doc/'
|
|
|
|
AssertEqual map(file.finddir('doc/', fnamemodify(path, ':p'), 0), 'file.unify_path(v:val, ":.")'), ['bundle/dein.vim/doc/', 'doc/']
|
|
|
|
AssertEqual file.unify_path(file.finddir('doc/', fnamemodify(path, ':p'), -1), ':.'), 'doc/'
|
|
|
|
unlet file path
|