spacevim/bundle/phpcomplete.vim-vim7/tests/GetCurrentSymbolWithContext_test.vim
JIe 2bb7059579
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
init
2024-08-21 14:17:26 +08:00

95 lines
4.0 KiB
VimL

fun! SetUp()
" normalize g:phpcomplete_min_num_of_chars_for_namespace_completion option
let g:phpcomplete_min_num_of_chars_for_namespace_completion = 2
" disable built-in classes
let g:php_builtin_classnames = {}
" disable built-in interfaces
let g:php_builtin_interfaces = {}
" disable built-in interfaces
let g:php_builtin_interfacenames = {}
" disable tags
exe ':set tags='
endf
fun! TestCase_returns_empty_strings_when_outside_php_block()
call SetUp()
let path = expand('%:p:h')."/".'fixtures/GetCurrentSymbolWithContext/foo.php'
below 1new
exe ":silent! edit ".path
call cursor(26, 1)
let res = phpcomplete#GetCurrentSymbolWithContext()
call VUAssertEquals(['', '', '', ''], res)
silent! bw! %
endf
fun! TestCase_returns_current_symbol_under_cursor()
call SetUp()
let path = expand('%:p:h')."/".'fixtures/GetCurrentSymbolWithContext/foo.php'
below 1new
exe ":silent! edit ".path
call cursor(18, 5)
let res = phpcomplete#GetCurrentSymbolWithContext()
call VUAssertEquals(['get_foo', '', '', {}], res)
call cursor(18, 13)
let res = phpcomplete#GetCurrentSymbolWithContext()
call VUAssertEquals(['baz', 'get_foo()->', '', {}], res)
call cursor(20, 1)
let res = phpcomplete#GetCurrentSymbolWithContext()
call VUAssertEquals(['Foo', '', '', {}], res)
call cursor(20, 8)
let res = phpcomplete#GetCurrentSymbolWithContext()
call VUAssertEquals(['baz', 'Foo::', '', {}], res)
call cursor(23, 29)
let res = phpcomplete#GetCurrentSymbolWithContext()
call VUAssertEquals(['returnFoo2', '$f2->returnBaz2()->', '', {}], res)
silent! bw! %
endf
fun! TestCase_returns_current_symbol_with_the_current_namespace_and_imports()
call SetUp()
exe ':set tags='.expand('%:p:h').'/'.'fixtures/GetCurrentSymbolWithContext/namespaced_tags'
let path = expand('%:p:h')."/".'fixtures/GetCurrentSymbolWithContext/namespaced_foo.php'
below 1new
exe ":silent! edit ".path
call cursor(21, 5)
let res = phpcomplete#GetCurrentSymbolWithContext()
call VUAssertEquals(['get_foo', '', 'NS1', {'RenamedFoo2': {'cmd': '/^class Foo2 {$/', 'static': 0, 'name': 'Foo2', 'namespace': 'NS2', 'kind': 'c', 'builtin': 0, 'filename': 'fixtures/GetCurrentSymbolWithContext/namespaced_foo2.php'}}], res)
call cursor(21, 13)
let res = phpcomplete#GetCurrentSymbolWithContext()
call VUAssertEquals(['baz', 'get_foo()->', 'NS1', {'RenamedFoo2': {'cmd': '/^class Foo2 {$/', 'static': 0, 'name': 'Foo2', 'namespace': 'NS2', 'kind': 'c', 'builtin': 0, 'filename': 'fixtures/GetCurrentSymbolWithContext/namespaced_foo2.php'}}], res)
call cursor(23, 18)
let res = phpcomplete#GetCurrentSymbolWithContext()
call VUAssertEquals(['Foo2', 'new \NS2\', 'NS2', {'RenamedFoo2': {'cmd': '/^class Foo2 {$/', 'static': 0, 'name': 'Foo2', 'namespace': 'NS2', 'kind': 'c', 'builtin': 0, 'filename': 'fixtures/GetCurrentSymbolWithContext/namespaced_foo2.php'}}], res)
call cursor(27, 18)
let res = phpcomplete#GetCurrentSymbolWithContext()
call VUAssertEquals(['Foo2', 'new', 'NS2', {'RenamedFoo2': {'cmd': '/^class Foo2 {$/', 'static': 0, 'name': 'Foo2', 'namespace': 'NS2', 'kind': 'c', 'builtin': 0, 'filename': 'fixtures/GetCurrentSymbolWithContext/namespaced_foo2.php'}}], res)
call cursor(3, 10)
let res = phpcomplete#GetCurrentSymbolWithContext()
call VUAssertEquals(['Foo2', 'use NS2\', 'NS2', {'RenamedFoo2': {'cmd': '/^class Foo2 {$/', 'static': 0, 'name': 'Foo2', 'namespace': 'NS2', 'kind': 'c', 'builtin': 0, 'filename': 'fixtures/GetCurrentSymbolWithContext/namespaced_foo2.php'}}], res)
call cursor(3, 20)
let res = phpcomplete#GetCurrentSymbolWithContext()
call VUAssertEquals(['Foo2', 'use NS2\Foo2 as', 'NS2', {'RenamedFoo2': {'cmd': '/^class Foo2 {$/', 'static': 0, 'name': 'Foo2', 'namespace': 'NS2', 'kind': 'c', 'builtin': 0, 'filename': 'fixtures/GetCurrentSymbolWithContext/namespaced_foo2.php'}}], res)
silent! bw! %
endf
" vim: foldmethod=marker:expandtab:ts=4:sts=4