How to run a single doc test

Let's consider that the output of cargo test -- --list contains the following test list:

[...]
src/mod1.rs - X::foo() (line 10): test
src/mod1.rs - X::bar() (line 20): test
src/mod2.rs - X::foo() (line 10): test
src/mod2.rs - X::bar() (line 20): test

What command should I run to only execute the test src/mod1.rs - X::foo() (line 10): test ?

cargo test -- "X::foo()\ (line\ 10)"
2 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.