test_exists_autocmd.vim 868 B

123456789101112131415161718192021222324252627
  1. " Test that groups and patterns are tested correctly when calling exists() for
  2. " autocommands.
  3. function Test_AutoCommands()
  4. let results=[]
  5. augroup auexists
  6. augroup END
  7. call assert_true(exists("##BufEnter"))
  8. call assert_false(exists("#BufEnter"))
  9. au BufEnter * let g:entered=1
  10. call assert_true(exists("#BufEnter"))
  11. call assert_false(exists("#auexists#BufEnter"))
  12. augroup auexists
  13. au BufEnter * let g:entered=1
  14. augroup END
  15. call assert_true(exists("#auexists#BufEnter"))
  16. call assert_false(exists("#BufEnter#*.test"))
  17. au BufEnter *.test let g:entered=1
  18. call assert_true(exists("#BufEnter#*.test"))
  19. edit testfile.test
  20. call assert_false(exists("#BufEnter#<buffer>"))
  21. au BufEnter <buffer> let g:entered=1
  22. call assert_true(exists("#BufEnter#<buffer>"))
  23. edit testfile2.test
  24. call assert_false(exists("#BufEnter#<buffer>"))
  25. endfunction