From 3fd9ffd36893cd82549956de6960282791573b87 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 9 Sep 2018 17:50:48 -0400 Subject: vim-patch:8.0.1377: cannot call a dict function in autoloaded dict Problem: Cannot call a dict function in autoloaded dict. Solution: Call get_lval() passing the read-only flag. https://github.com/vim/vim/commit/6e65d594aa33be11f6074f26e9ff81b52504c62b --- src/nvim/testdir/sautest/autoload/foo.vim | 7 +++++++ src/nvim/testdir/sautest/autoload/globone.vim | 1 + src/nvim/testdir/sautest/autoload/globtwo.vim | 1 + src/nvim/testdir/test_autoload.vim | 11 +++++++++++ src/nvim/testdir/test_escaped_glob.vim | 10 +++++----- 5 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 src/nvim/testdir/sautest/autoload/foo.vim create mode 100644 src/nvim/testdir/sautest/autoload/globone.vim create mode 100644 src/nvim/testdir/sautest/autoload/globtwo.vim create mode 100644 src/nvim/testdir/test_autoload.vim (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/sautest/autoload/foo.vim b/src/nvim/testdir/sautest/autoload/foo.vim new file mode 100644 index 0000000000..d7dcd5ce3d --- /dev/null +++ b/src/nvim/testdir/sautest/autoload/foo.vim @@ -0,0 +1,7 @@ +let g:loaded_foo_vim += 1 + +let foo#bar = {} + +func foo#bar.echo() + let g:called_foo_bar_echo += 1 +endfunc diff --git a/src/nvim/testdir/sautest/autoload/globone.vim b/src/nvim/testdir/sautest/autoload/globone.vim new file mode 100644 index 0000000000..98c9a10582 --- /dev/null +++ b/src/nvim/testdir/sautest/autoload/globone.vim @@ -0,0 +1 @@ +" used by Test_globpath() diff --git a/src/nvim/testdir/sautest/autoload/globtwo.vim b/src/nvim/testdir/sautest/autoload/globtwo.vim new file mode 100644 index 0000000000..98c9a10582 --- /dev/null +++ b/src/nvim/testdir/sautest/autoload/globtwo.vim @@ -0,0 +1 @@ +" used by Test_globpath() diff --git a/src/nvim/testdir/test_autoload.vim b/src/nvim/testdir/test_autoload.vim new file mode 100644 index 0000000000..a92851f655 --- /dev/null +++ b/src/nvim/testdir/test_autoload.vim @@ -0,0 +1,11 @@ +" Tests for autoload + +set runtimepath=./sautest + +func! Test_autoload_dict_func() + let g:loaded_foo_vim = 0 + let g:called_foo_bar_echo = 0 + call g:foo#bar.echo() + call assert_equal(1, g:loaded_foo_vim) + call assert_equal(1, g:called_foo_bar_echo) +endfunc diff --git a/src/nvim/testdir/test_escaped_glob.vim b/src/nvim/testdir/test_escaped_glob.vim index 430317a23a..eaeac28d61 100644 --- a/src/nvim/testdir/test_escaped_glob.vim +++ b/src/nvim/testdir/test_escaped_glob.vim @@ -17,6 +17,7 @@ function Test_glob() call assert_equal("", glob('Xxx\{')) call assert_equal("", glob('Xxx\$')) w! Xxx{ + " } to fix highlighting w! Xxx\$ call assert_equal("Xxx{", glob('Xxx\{')) call assert_equal("Xxx$", glob('Xxx\$')) @@ -25,9 +26,8 @@ function Test_glob() endfunction function Test_globpath() - let slash = (!exists('+shellslash') || &shellslash) ? '/' : '\' - call assert_equal('sautest'.slash.'autoload'.slash.'footest.vim', - \ globpath('sautest/autoload', '*.vim')) - call assert_equal(['sautest'.slash.'autoload'.slash.'footest.vim'], - \ globpath('sautest/autoload', '*.vim', 0, 1)) + call assert_equal(expand("sautest/autoload/globone.vim\nsautest/autoload/globtwo.vim"), + \ globpath('sautest/autoload', 'glob*.vim')) + call assert_equal([expand('sautest/autoload/globone.vim'), expand('sautest/autoload/globtwo.vim')], + \ globpath('sautest/autoload', 'glob*.vim', 0, 1)) endfunction -- cgit