1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-24 19:20:06 +08:00
SpaceVim/test/api/file.vader

17 lines
1.2 KiB
Plaintext
Raw Normal View History

Execute ( SpaceVim api: file ):
let &encoding = 'utf-8'
let g:spacevim_filetype_icons = {}
let file = SpaceVim#api#import('file')
AssertEqual file.fticon('foo.md'), ''
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