Some checks failed
Detach Plugins / check (FlyGrep.vim) (push) Has been cancelled
Detach Plugins / check (GitHub.vim) (push) Has been cancelled
Detach Plugins / check (JavaUnit.vim) (push) Has been cancelled
Detach Plugins / check (SourceCounter.vim) (push) Has been cancelled
Detach Plugins / check (cpicker.nvim) (push) Has been cancelled
Detach Plugins / check (dein-ui.vim) (push) Has been cancelled
Detach Plugins / check (git.vim) (push) Has been cancelled
Detach Plugins / check (iedit.vim) (push) Has been cancelled
Detach Plugins / check (scrollbar.vim) (push) Has been cancelled
Detach Plugins / check (vim-chat) (push) Has been cancelled
Detach Plugins / check (vim-cheat) (push) Has been cancelled
Detach Plugins / check (vim-todo) (push) Has been cancelled
Detach Plugins / check (xmake.vim) (push) Has been cancelled
test / Linux (nvim, nightly) (push) Has been cancelled
test / Linux (nvim, v0.3.8) (push) Has been cancelled
test / Linux (nvim, v0.4.0) (push) Has been cancelled
test / Linux (nvim, v0.4.2) (push) Has been cancelled
test / Linux (nvim, v0.4.3) (push) Has been cancelled
test / Linux (nvim, v0.4.4) (push) Has been cancelled
test / Linux (nvim, v0.5.0) (push) Has been cancelled
test / Linux (nvim, v0.5.1) (push) Has been cancelled
test / Linux (nvim, v0.6.0) (push) Has been cancelled
test / Linux (nvim, v0.6.1) (push) Has been cancelled
test / Linux (nvim, v0.7.0) (push) Has been cancelled
test / Linux (nvim, v0.7.2) (push) Has been cancelled
test / Linux (nvim, v0.8.0) (push) Has been cancelled
test / Linux (nvim, v0.8.1) (push) Has been cancelled
test / Linux (nvim, v0.8.2) (push) Has been cancelled
test / Linux (nvim, v0.8.3) (push) Has been cancelled
test / Linux (nvim, v0.9.0) (push) Has been cancelled
test / Linux (nvim, v0.9.1) (push) Has been cancelled
test / Linux (true, vim, v7.4.052) (push) Has been cancelled
test / Linux (true, vim, v7.4.1689) (push) Has been cancelled
test / Linux (true, vim, v7.4.629) (push) Has been cancelled
test / Linux (true, vim, v8.0.0027) (push) Has been cancelled
test / Linux (true, vim, v8.0.0183) (push) Has been cancelled
test / Linux (vim, nightly) (push) Has been cancelled
test / Linux (vim, v8.0.0184) (push) Has been cancelled
test / Linux (vim, v8.0.1453) (push) Has been cancelled
test / Linux (vim, v8.1.2269) (push) Has been cancelled
test / Linux (vim, v8.2.2434) (push) Has been cancelled
test / Linux (vim, v8.2.3995) (push) Has been cancelled
test / Windows (nvim, nightly) (push) Has been cancelled
test / Windows (nvim, v0.3.8) (push) Has been cancelled
test / Windows (nvim, v0.4.2) (push) Has been cancelled
test / Windows (nvim, v0.4.3) (push) Has been cancelled
test / Windows (nvim, v0.4.4) (push) Has been cancelled
test / Windows (nvim, v0.5.0) (push) Has been cancelled
test / Windows (nvim, v0.5.1) (push) Has been cancelled
test / Windows (nvim, v0.6.0) (push) Has been cancelled
test / Windows (nvim, v0.6.1) (push) Has been cancelled
test / Windows (nvim, v0.7.0) (push) Has been cancelled
test / Windows (nvim, v0.7.2) (push) Has been cancelled
test / Windows (nvim, v0.8.0) (push) Has been cancelled
test / Windows (nvim, v0.8.1) (push) Has been cancelled
test / Windows (nvim, v0.8.2) (push) Has been cancelled
test / Windows (nvim, v0.8.3) (push) Has been cancelled
test / Windows (nvim, v0.9.0) (push) Has been cancelled
test / Windows (nvim, v0.9.1) (push) Has been cancelled
test / Windows (vim, nightly) (push) Has been cancelled
test / Windows (vim, v7.4.1185) (push) Has been cancelled
test / Windows (vim, v7.4.1689) (push) Has been cancelled
test / Windows (vim, v8.0.0027) (push) Has been cancelled
test / Windows (vim, v8.0.1453) (push) Has been cancelled
test / Windows (vim, v8.1.2269) (push) Has been cancelled
test / Windows (vim, v8.2.2434) (push) Has been cancelled
test / Windows (vim, v8.2.3995) (push) Has been cancelled
docker / docker (push) Has been cancelled
mirror / check (coding) (push) Has been cancelled
mirror / check (gitee) (push) Has been cancelled
mirror / check (gitlab) (push) Has been cancelled
108 lines
5.1 KiB
VimL
108 lines
5.1 KiB
VimL
fun! SetUp()
|
|
exe ':set tags='
|
|
endf
|
|
|
|
fun! TestCase_returns_slash_when_no_namespace_found()
|
|
call SetUp()
|
|
let [namespace, imports] = phpcomplete#GetCurrentNameSpace([])
|
|
call VUAssertEquals('\', namespace)
|
|
endf
|
|
|
|
fun! TestCase_returns_namespace_from_file_lines()
|
|
call SetUp()
|
|
let file_lines = readfile(expand('%:p:h').'/'.'fixtures/GetCurrentNameSpace/single_namespace.php')
|
|
let [namespace, imports] = phpcomplete#GetCurrentNameSpace(file_lines)
|
|
call VUAssertEquals('Mahou', namespace)
|
|
|
|
let file_lines = readfile(expand('%:p:h').'/'.'fixtures/GetCurrentNameSpace/single_namespace2.php')
|
|
let [namespace, imports] = phpcomplete#GetCurrentNameSpace(file_lines)
|
|
call VUAssertEquals('Mahou', namespace)
|
|
endf
|
|
|
|
fun! TestCase_returns_closest_namespace_from_the_current_line()
|
|
call SetUp()
|
|
let file_lines = readfile(expand('%:p:h').'/'.'fixtures/GetCurrentNameSpace/multiple_namespace.php')
|
|
let [namespace, imports] = phpcomplete#GetCurrentNameSpace(file_lines)
|
|
call VUAssertEquals('FindMe', namespace)
|
|
endf
|
|
|
|
fun! TestCase_returns_imported_namespaces_and_classes_with_their_info_from_tags()
|
|
call SetUp()
|
|
|
|
exe 'set tags='.expand('%:p:h')."/".'fixtures/common/namespaced_foo_tags'
|
|
let file_lines = readfile(expand('%:p:h').'/'.'fixtures/GetCurrentNameSpace/imports.php')
|
|
|
|
call phpcomplete#LoadData()
|
|
|
|
let [namespace, imports] = phpcomplete#GetCurrentNameSpace(file_lines)
|
|
call VUAssertEquals({
|
|
\ 'Foo': {'cmd': '/^class Foo {$/', 'static': 0, 'name': 'Foo', 'namespace': 'NS1', 'kind': 'c', 'builtin': 0, 'filename': 'fixtures/common/namespaced_foo.php'},
|
|
\ 'ArrayAccess': {'name': 'ArrayAccess', 'kind': 'i', 'builtin': 1},
|
|
\ 'AO': {'name': 'ArrayObject', 'kind': 'c', 'builtin': 1},
|
|
\ 'DateTimeZone': {'name': 'DateTimeZone', 'kind': 'c', 'builtin': 1},
|
|
\ 'LE': {'name': 'LogicException', 'kind': 'c', 'builtin': 1},
|
|
\ 'DateTime': {'name': 'DateTime', 'kind': 'c', 'builtin': 1},
|
|
\ 'SUBNS': {'cmd': '/^namespace NS1\\SUBNS;$/', 'static': 0, 'name': 'NS1\SUBNS', 'kind': 'n', 'builtin': 0, 'filename': 'fixtures/common/namespaced_foo.php'},
|
|
\ 'EE': {'name': 'ErrorException', 'kind': 'c', 'builtin': 1},
|
|
\ 'E': {'name': 'Exception', 'kind': 'c', 'builtin': 1}},
|
|
\ imports)
|
|
|
|
" with old style tags, matching tags with no namespace matches will be returned
|
|
" matching is done regardeless of the namespace we are actually looking
|
|
" for however the desired namespace will be added to the tag
|
|
" namespace import just not recognized with the kind 'n' and filename
|
|
exe 'set tags='.expand('%:p:h')."/".'fixtures/common/old_style_namespaced_foo_tags'
|
|
let [namespace, imports] = phpcomplete#GetCurrentNameSpace(file_lines)
|
|
call VUAssertEquals({
|
|
\ 'Foo': {'cmd': '/^class Foo {$/', 'static': 0, 'name': 'Foo', 'namespace': 'NS1', 'kind': 'c', 'builtin': 0, 'filename': 'fixtures/common/fixtures/common/namespaced_foo.php'},
|
|
\ 'ArrayAccess': {'name': 'ArrayAccess', 'kind': 'i', 'builtin': 1},
|
|
\ 'AO': {'name': 'ArrayObject', 'kind': 'c', 'builtin': 1},
|
|
\ 'DateTimeZone': {'name': 'DateTimeZone', 'kind': 'c', 'builtin': 1},
|
|
\ 'LE': {'name': 'LogicException', 'kind': 'c', 'builtin': 1},
|
|
\ 'DateTime': {'name': 'DateTime', 'kind': 'c', 'builtin': 1},
|
|
\ 'SUBNS': {'name': 'SUBNS', 'namespace': 'NS1', 'kind': '', 'builtin': 0},
|
|
\ 'EE': {'name': 'ErrorException', 'kind': 'c', 'builtin': 1},
|
|
\ 'E': {'name': 'Exception', 'kind': 'c', 'builtin': 1}},
|
|
\ imports)
|
|
endf
|
|
|
|
fun! TestCase_does_not_pick_up_trait_uses_inside_classes()
|
|
call SetUp()
|
|
|
|
let file_lines = readfile(expand('%:p:h').'/'.'fixtures/GetCurrentNameSpace/traits.php')
|
|
call phpcomplete#LoadData()
|
|
|
|
let [namespace, imports] = phpcomplete#GetCurrentNameSpace(file_lines)
|
|
call VUAssertEquals('NS1', namespace)
|
|
call VUAssertEquals({
|
|
\ 'DateTime': {'name': 'DateTime', 'kind': 'c', 'builtin': 1},
|
|
\}, imports)
|
|
|
|
endf
|
|
|
|
fun! TestCase_should_pick_up_imports_regardeless_the_upperlower_case_of_keywords()
|
|
call SetUp()
|
|
call phpcomplete#LoadData()
|
|
|
|
let file_lines = readfile(expand('%:p:h').'/'.'fixtures/GetCurrentNameSpace/single_namespace_uppercase.php')
|
|
let [namespace, imports] = phpcomplete#GetCurrentNameSpace(file_lines)
|
|
call VUAssertEquals('Mahou', namespace)
|
|
call VUAssertEquals({
|
|
\ 'DT': {'name': 'DateTime', 'kind': 'c', 'builtin': 1}},
|
|
\ imports)
|
|
endf
|
|
|
|
fun! TestCase_should_find_imports_when_called_with_non_balanced_braces()
|
|
call SetUp()
|
|
|
|
let file_lines = readfile(expand('%:p:h').'/'.'fixtures/GetCurrentNameSpace/code_blocks.php')[0:7]
|
|
call phpcomplete#LoadData()
|
|
|
|
let [namespace, imports] = phpcomplete#GetCurrentNameSpace(file_lines)
|
|
call VUAssertEquals({
|
|
\ 'SomeChildNS': {'name': 'SomeChildNS', 'namespace': 'SomeParentNS', 'kind': '', 'builtin': 0}
|
|
\}, imports)
|
|
endf
|
|
|
|
" vim: foldmethod=marker:expandtab:ts=4:sts=4
|