view src/testdir/test_exists_autocmd.vim @ 22163:b6d36f0b4f03 v8.2.1631

patch 8.2.1631: test_fails() does not check the context of the line number Commit: https://github.com/vim/vim/commit/9bd5d879c2ecfbdbb168b090e12f4b89724a302e Author: Bram Moolenaar <Bram@vim.org> Date: Sun Sep 6 21:47:48 2020 +0200 patch 8.2.1631: test_fails() does not check the context of the line number Problem: test_fails() does not check the context of the line number. Solution: Use another argument to specify the context of the line number.
author Bram Moolenaar <Bram@vim.org>
date Sun, 06 Sep 2020 22:00:03 +0200
parents 08940efa6b4e
children
line wrap: on
line source

" Test that groups and patterns are tested correctly when calling exists() for
" autocommands.

function Test_AutoCommands()
  let results=[]
  augroup auexists
  augroup END
  call assert_true(exists("##BufEnter"))
  call assert_false(exists("#BufEnter"))
  au BufEnter * let g:entered=1
  call assert_true(exists("#BufEnter"))
  call assert_false(exists("#auexists#BufEnter"))
  augroup auexists
  au BufEnter * let g:entered=1
  augroup END
  call assert_true(exists("#auexists#BufEnter"))
  call assert_false(exists("#BufEnter#*.test"))
  au BufEnter *.test let g:entered=1
  call assert_true(exists("#BufEnter#*.test"))
  edit testfile.test
  call assert_false(exists("#BufEnter#<buffer>"))
  au BufEnter <buffer> let g:entered=1
  call assert_true(exists("#BufEnter#<buffer>"))
  edit testfile2.test
  call assert_false(exists("#BufEnter#<buffer>"))
endfunction

" vim: shiftwidth=2 sts=2 expandtab