Mercurial > vim
annotate src/testdir/test_autoload.vim @ 29903:08cbdf656975
Added tag v9.0.0289 for changeset ab2d83e147ca5f32fada66dcf5a3b69bfd033abf
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 27 Aug 2022 23:00:03 +0200 |
parents | 307341b9c227 |
children | a786d0dab454 |
rev | line source |
---|---|
13002
f7b2ecaeb79c
patch 8.0.1377: cannot call a dict function in autoloaded dict
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Tests for autoload |
f7b2ecaeb79c
patch 8.0.1377: cannot call a dict function in autoloaded dict
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
f7b2ecaeb79c
patch 8.0.1377: cannot call a dict function in autoloaded dict
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 set runtimepath=./sautest |
f7b2ecaeb79c
patch 8.0.1377: cannot call a dict function in autoloaded dict
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 |
13004
41e46caf1030
patch 8.0.1378: autoload script sources itself when defining function
Christian Brabandt <cb@256bit.org>
parents:
13002
diff
changeset
|
5 func Test_autoload_dict_func() |
13002
f7b2ecaeb79c
patch 8.0.1377: cannot call a dict function in autoloaded dict
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 let g:loaded_foo_vim = 0 |
f7b2ecaeb79c
patch 8.0.1377: cannot call a dict function in autoloaded dict
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 let g:called_foo_bar_echo = 0 |
f7b2ecaeb79c
patch 8.0.1377: cannot call a dict function in autoloaded dict
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 call g:foo#bar.echo() |
f7b2ecaeb79c
patch 8.0.1377: cannot call a dict function in autoloaded dict
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 call assert_equal(1, g:loaded_foo_vim) |
f7b2ecaeb79c
patch 8.0.1377: cannot call a dict function in autoloaded dict
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 call assert_equal(1, g:called_foo_bar_echo) |
17638
9ffec4eb8d33
patch 8.1.1816: cannot use a user defined function as a method
Bram Moolenaar <Bram@vim.org>
parents:
13004
diff
changeset
|
11 |
9ffec4eb8d33
patch 8.1.1816: cannot use a user defined function as a method
Bram Moolenaar <Bram@vim.org>
parents:
13004
diff
changeset
|
12 eval 'bar'->g:foo#addFoo()->assert_equal('barfoo') |
27279
6e1b0c4ab668
patch 8.2.4168: disallowing empty function name breaks existing plugins
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
13 |
6e1b0c4ab668
patch 8.2.4168: disallowing empty function name breaks existing plugins
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
14 " empty name works in legacy script |
6e1b0c4ab668
patch 8.2.4168: disallowing empty function name breaks existing plugins
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
15 call assert_equal('empty', foo#()) |
13002
f7b2ecaeb79c
patch 8.0.1377: cannot call a dict function in autoloaded dict
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 endfunc |
13004
41e46caf1030
patch 8.0.1378: autoload script sources itself when defining function
Christian Brabandt <cb@256bit.org>
parents:
13002
diff
changeset
|
17 |
41e46caf1030
patch 8.0.1378: autoload script sources itself when defining function
Christian Brabandt <cb@256bit.org>
parents:
13002
diff
changeset
|
18 func Test_source_autoload() |
41e46caf1030
patch 8.0.1378: autoload script sources itself when defining function
Christian Brabandt <cb@256bit.org>
parents:
13002
diff
changeset
|
19 let g:loaded_sourced_vim = 0 |
41e46caf1030
patch 8.0.1378: autoload script sources itself when defining function
Christian Brabandt <cb@256bit.org>
parents:
13002
diff
changeset
|
20 source sautest/autoload/sourced.vim |
41e46caf1030
patch 8.0.1378: autoload script sources itself when defining function
Christian Brabandt <cb@256bit.org>
parents:
13002
diff
changeset
|
21 call assert_equal(1, g:loaded_sourced_vim) |
41e46caf1030
patch 8.0.1378: autoload script sources itself when defining function
Christian Brabandt <cb@256bit.org>
parents:
13002
diff
changeset
|
22 endfunc |
21550
b0b57d91671c
patch 8.2.1325: Vim9: using Vim9 script for autaload not tested
Bram Moolenaar <Bram@vim.org>
parents:
17638
diff
changeset
|
23 |
b0b57d91671c
patch 8.2.1325: Vim9: using Vim9 script for autaload not tested
Bram Moolenaar <Bram@vim.org>
parents:
17638
diff
changeset
|
24 func Test_autoload_vim9script() |
27474
307341b9c227
patch 8.2.4265: autoload tests fails
Bram Moolenaar <Bram@vim.org>
parents:
27279
diff
changeset
|
25 call assert_equal('some', auto9#Getsome()) |
307341b9c227
patch 8.2.4265: autoload tests fails
Bram Moolenaar <Bram@vim.org>
parents:
27279
diff
changeset
|
26 call assert_equal(49, auto9#Add42(7)) |
21550
b0b57d91671c
patch 8.2.1325: Vim9: using Vim9 script for autaload not tested
Bram Moolenaar <Bram@vim.org>
parents:
17638
diff
changeset
|
27 endfunc |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
21550
diff
changeset
|
28 |
27279
6e1b0c4ab668
patch 8.2.4168: disallowing empty function name breaks existing plugins
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
29 |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
21550
diff
changeset
|
30 " vim: shiftwidth=2 sts=2 expandtab |