Open runiq opened 4 years ago
Hmm, that's strange. I wrote many tests for several plugins which use autocmd
and I've never experienced such a problem. I'll look into it later.
Just to make sure, would you mind pasting the result of vim --version
?
vim --version
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Mar 3 2020 00:00:00) Included patches: 1-348 Modified byCompiled by Huge version without GUI. Features included (+) or not (-): +acl -farsi -mouse_sysmouse -tag_old_static +arabic +file_in_path +mouse_urxvt -tag_any_white +autocmd +find_in_path +mouse_xterm -tcl +autochdir +float +multi_byte +termguicolors -autoservername +folding +multi_lang +terminal -balloon_eval -footer -mzscheme +terminfo +balloon_eval_term +fork() +netbeans_intg +termresponse -browse +gettext +num64 +textobjects ++builtin_terms -hangul_input +packages +textprop +byte_offset +iconv +path_extra +timers +channel +insert_expand +perl/dyn +title +cindent +job +persistent_undo -toolbar -clientserver +jumplist +popupwin +user_commands -clipboard +keymap +postscript +vartabs +cmdline_compl +lambda +printer +vertsplit +cmdline_hist +langmap +profile +virtualedit +cmdline_info +libcall -python +visual +comments +linebreak +python3/dyn +visualextra +conceal +lispindent +quickfix +viminfo +cryptv +listcmds +reltime +vreplace +cscope +localmap +rightleft +wildignore +cursorbind +lua/dyn +ruby/dyn +wildmenu +cursorshape +menu +scrollbind +windows +dialog_con +mksession +signs +writebackup +diff +modify_fname +smartindent -X11 +digraphs +mouse -sound -xfontset -dnd -mouseshape +spell -xim -ebcdic +mouse_dec +startuptime -xpm +emacs_tags +mouse_gpm +statusline -xsmp +eval -mouse_jsbterm -sun_workshop -xterm_clipboard +ex_extra +mouse_netterm +syntax -xterm_save +extra_search +mouse_sgr +tag_binary system vimrc file: "/etc/vimrc" user vimrc file: "$HOME/.vimrc" 2nd user vimrc file: "~/.vim/vimrc" user exrc file: "$HOME/.exrc" defaults file: "$VIMRUNTIME/defaults.vim" fall-back for $VIM: "/etc" f-b for $VIMRUNTIME: "/usr/share/vim/vim82" Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 Linking: gcc -L. -Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--enable-new-dtags -Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -lpython3.7m -lcrypt -lpthread -ldl -lutil -lm -L/usr/local/lib -Wl,--as-needed -o vim -lm -lselinux -lncurses -lacl -lattr -lgpm -ldl -Wl,--enable-new-dtags -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fstack-protector-strong -L/usr/local/lib -L/usr/lib64/perl5/CORE -lperl -lpthread -lresolv -ldl -lm -lcrypt -lutil -lc
I'm on an up-to-date Fedora 31 in case that matters.
I confirmed that the problem is reproducible.
And I noticed that there are two types of autocmd
events — some events work fine in tests, but other events don't work in tests for some reason. For example, TabEnter
and BufReadCmd
work in tests, but OptionSet
and BufRead
don't work in tests.
I'll dig into the problem later.
No need to hurry, I found a workaround for now. :)
Hi,
It looks like autocmds in tests aren't registered.
How to reproduce:
plugin/foo.vim
:t/foo.vim
:Result:
Note the
Undefined variable: g:foo
, which doesn't happen if I run the commands in my test function manually.Do you know why that is so?
Anyway, thanks a lot for this plugin! :)