Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RustTest doesn't recognize tokio::test #463

Open
mooreniemi opened this issue Nov 14, 2021 · 3 comments
Open

RustTest doesn't recognize tokio::test #463

mooreniemi opened this issue Nov 14, 2021 · 3 comments

Comments

@mooreniemi
Copy link

  • rust.vim version: Using latest via vim-plug

Steps to reproduce:

  • Put cursor on test function name
  • :RustTest

Expected vs. actual behavior:

  • Expected: runs the test
  • Actual: finds no test under cursor

Works:

#[test]
fn test() {}

Does not work:

#[tokio::test]
async fn a_test() {}

Paste debugging info from the Rust Vim plugin via one of the following
commands: :RustInfo, :RustInfoToClipboard, or :RustInfoToFile <filename>.

rust.vim Global Variables:

let g:ftplugin_rust_source_path = v:null
let g:loaded_syntastic_rust_cargo_checker = 1
let g:loaded_syntastic_rust_filetype = v:null
let g:loaded_syntastic_rust_rustc_checker = 1
let g:rust_bang_comment_leader = v:null
let g:rust_cargo_avoid_whole_workspace = v:null
let g:rust_clip_command = v:null
let g:rust_conceal = v:null
let g:rust_conceal_mod_path = v:null
let g:rust_conceal_pub = v:null
let g:rust_fold = v:null
let g:rust_last_args = v:null
let b:rust_last_args = []
let g:rust_last_rustc_args = v:null
let b:rust_last_rustc_args = []
let g:rust_original_delimitMate_excluded_regions = v:null
let g:rust_playpen_url = v:null
let g:rust_prev_delimitMate_quotes = v:null
let g:rust_recent_nearest_cargo_tol = v:null
let g:rust_recent_root_cargo_toml = v:null
let g:rust_recommended_style = v:null
let g:rust_set_conceallevel = v:null
let g:rust_set_conceallevel=1 = v:null
let g:rust_set_foldmethod = v:null
let g:rust_set_foldmethod=1 = v:null
let g:rust_shortener_url = v:null
let g:rustc_makeprg_no_percent = v:null
let g:rustc_path = v:null
let g:rustfmt_autosave = 1
let g:rustfmt_autosave_if_config_present = v:null
let g:rustfmt_command = 'rustfmt'
let g:rustfmt_emit_files = 1
let g:rustfmt_fail_silently = 0
let g:rustfmt_options = ''
let g:syntastic_extra_filetypes = ['rust']
let g:syntastic_rust_cargo_fname = ''
rustfmt 1.4.38-nightly (e90c5fb 2021-11-12)

rustc 1.58.0-nightly (e90c5fbbc 2021-11-12)

cargo 1.58.0-nightly (2e2a16e98 2021-11-08)


VIM - Vi IMproved 8.1 (2018 May 18, compiled Sep 20 2021 11:42:42)
Included patches: 1-2269
Modified by team+vim@tracker.debian.org
Compiled by team+vim@tracker.debian.org
Huge version with GTK3 GUI.  Features included (+) or not (-):
+acl               +conceal           +folding           +menu              +packages          +startuptime       +vartabs
+arabic            +cryptv            -footer            +mksession         +path_extra        +statusline        +vertsplit
+autocmd           +cscope            +fork()            +modify_fname      +perl              -sun_workshop      +virtualedit
+autochdir         +cursorbind        +gettext           +mouse             +persistent_undo   +syntax            +visual
-autoservername    +cursorshape       -hangul_input      +mouseshape        +postscript        +tag_binary        +visualextra
+balloon_eval      +dialog_con_gui    +iconv             +mouse_dec         +printer           -tag_old_static    +viminfo
+balloon_eval_term +diff              +insert_expand     +mouse_gpm         +profile           -tag_any_white     +vreplace
+browse            +digraphs          +job               -mouse_jsbterm     -python            +tcl               +wildignore
++builtin_terms    +dnd               +jumplist          +mouse_netterm     +python3           +termguicolors     +wildmenu
+byte_offset       -ebcdic            +keymap            +mouse_sgr         +quickfix          +terminal          +windows
+channel           +emacs_tags        +lambda            -mouse_sysmouse    +reltime           +terminfo          +writebackup
+cindent           +eval              +langmap           +mouse_urxvt       +rightleft         +termresponse      +X11
+clientserver      +ex_extra          +libcall           +mouse_xterm       -ruby              +textobjects       -xfontset
+clipboard         +extra_search      +linebreak         +multi_byte        +scrollbind        +textprop          +xim
+cmdline_compl     -farsi             +lispindent        +multi_lang        +signs             +timers            +xpm
+cmdline_hist      +file_in_path      +listcmds          -mzscheme          +smartindent       +title             +xsmp_interact
+cmdline_info      +find_in_path      +localmap          +netbeans_intg     +sound             +toolbar           +xterm_clipboard
+comments          +float             +lua               +num64             +spell             +user_commands     -xterm_save
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/include/harfbuzz -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -Wdate-time  -g -O2 -fdebug-prefix-map=/build/vim-RjZCd2/vim-8.1.2269=. -fstack-protector-strong -Wformat -Werror=format-security -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
Linking: gcc   -Wl,-E  -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim   -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE  -lm -ltinfo -lnsl  -lselinux  -lcanberra -lacl -lattr -lgpm -ldl  -L/usr/lib -llua5.2 -Wl,-E  -fstack-protector-strong -L/usr/local/lib  -L/usr/lib/x86_64-linux-gnu/perl/5.30/CORE -lperl -ldl -lm -lpthread -lcrypt  -L/usr/lib/python3.8/config-3.8-x86_64-linux-gnu -lpython3.8 -lcrypt -lpthread -ldl -lutil -lm -lm -L/usr/lib/x86_64-linux-gnu -ltcl8.6 -ldl -lz -lpthread -lm     
----
Info from Syntastic:
Syntastic version: 3.10.0-32 (Vim 801, Linux, GUI)
Info for filetype: rust
Global mode: active
Filetype rust is active
The current file will be checked automatically
Available checkers: cargo rustc
Currently enabled checker: cargo
@mooreniemi
Copy link
Author

I figure due to this not matching:

if search('\m\C#\[test\]', 'bcW') is 0

@Maximkaaa
Copy link

The second regex (search('\m\C^\s*fn\s\+\h\w*\s*(.\+{$', 'eW')) also does not work because tokio::test functions are async, and async fn is not matched by it. If someone would fix it, make a note that the test functions can be also pub fn or pub(crate) fn or pub async(crate) fn.

@arijitdasgupta
Copy link

Hello! Sorry for deadposting, but has there been any update on this? 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants