Loading ...
Sorry, an error occurred while loading the content.

54905Re: au_exists bug, was Re: Test Existence of Autocommand?

Expand Messages
  • Bob Hiestand
    Sep 3, 2009
    • 0 Attachment
      On Thu, Sep 3, 2009 at 6:13 AM, Bram Moolenaar<Bram@...> wrote:

      >> Here's a probably better patch, and a test case to show the behavior I
      >> expect from exists() with respect to autocommands:
      >
      > Thanks for the patch and testcase script.  Would you be able to turn the
      > script into a test for src/testdir?  That will greatly help avoid
      > regressions.

      Sure, something like the following?

      diff --git a/src/testdir/Makefile b/src/testdir/Makefile
      index 50386ec..8f9fd13 100644
      --- a/src/testdir/Makefile
      +++ b/src/testdir/Makefile
      @@ -22,7 +22,7 @@ SCRIPTS = test1.out test2.out test3.out test4.out
      test5.out test6.out \
      test48.out test49.out test51.out test52.out test53.out \
      test54.out test55.out test56.out test57.out test58.out \
      test59.out test60.out test61.out test62.out test63.out \
      - test64.out test65.out test66.out
      + test64.out test65.out test66.out test67.out

      SCRIPTS_GUI = test16.out

      diff --git a/src/testdir/test67.in b/src/testdir/test67.in
      new file mode 100644
      index 0000000..46221ea
      --- /dev/null
      +++ b/src/testdir/test67.in
      @@ -0,0 +1,32 @@
      +Test that groups and patterns are tested correctly when calling
      exists() for autocommands.
      +
      +STARTTEST
      +:so small.vim
      +:let results=[]
      +:augroup auexists
      +:augroup END
      +:call add(results, exists('##BufEnter'))
      +:call add(results, exists("#BufEnter"))
      +:au BufEnter * let g:entered=1
      +:call add(results, exists("#BufEnter"))
      +:call add(results, exists("#auexists#BufEnter"))
      +:augroup auexists
      +:au BufEnter * let g:entered=1
      +:augroup END
      +:call add(results, exists("#auexists#BufEnter"))
      +:call add(results, exists("#BufEnter#*.test"))
      +:au BufEnter *.test let g:entered=1
      +:call add(results, exists("#BufEnter#*.test"))
      +:edit testfile.test
      +:call add(results, exists("#BufEnter#<buffer>"))
      +:au BufEnter <buffer> let g:entered=1
      +:call add(results, exists("#BufEnter#<buffer>"))
      +:edit testfile2.test
      +:call add(results, exists("#BufEnter#<buffer>"))
      +:e test.out
      +:call append(0, results)
      +:$d
      +:w
      +:qa!
      +ENDTEST
      +
      diff --git a/src/testdir/test67.ok b/src/testdir/test67.ok
      new file mode 100644
      index 0000000..61e9344
      --- /dev/null
      +++ b/src/testdir/test67.ok
      @@ -0,0 +1,10 @@
      +1
      +0
      +1
      +0
      +1
      +0
      +1
      +0
      +1
      +0

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_dev" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Show all 6 messages in this topic