test_autoload.vim 576 B

12345678910111213141516171819202122232425
  1. " Tests for autoload
  2. set runtimepath=./sautest
  3. func Test_autoload_dict_func()
  4. let g:loaded_foo_vim = 0
  5. let g:called_foo_bar_echo = 0
  6. call g:foo#bar.echo()
  7. call assert_equal(1, g:loaded_foo_vim)
  8. call assert_equal(1, g:called_foo_bar_echo)
  9. eval 'bar'->g:foo#addFoo()->assert_equal('barfoo')
  10. " empty name works in legacy script
  11. call assert_equal('empty', foo#())
  12. endfunc
  13. func Test_source_autoload()
  14. let g:loaded_sourced_vim = 0
  15. source sautest/autoload/sourced.vim
  16. call assert_equal(1, g:loaded_sourced_vim)
  17. endfunc
  18. " vim: shiftwidth=2 sts=2 expandtab