不使用通用过滤器进行多项测试

发布于 2025-01-16 16:21:35 字数 258 浏览 1 评论 0原文

我有一个名为 builtin_functionsdesign_variables 的测试,如何才能只运行这两个测试而不运行其他测试。

我天真地尝试了 cargo testbuiltin_functions,design_variablescargo testbuiltin_functions design_variables 但都不起作用。

我能做些什么?

I have a test named builtin_functions and design_variables how can I run only these two tests and nothing else.

I have naively tried cargo test builtin_functions,design_variables and cargo test builtin_functions design_variables but neither work.

What can I do?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

罪#恶を代价 2025-01-23 16:21:35

不幸的是,只有两种方法可以实现您指定的行为,但两种方法都不是很好。您可以键入

cargo test builtin_functions && cargo test design_variables

,有效地调用该函数两次
或者您可以添加一个明显任意的前缀,在运行它们之前只有这两个测试才会有,例如

fn foo_builtin_functions {
   /*...*/
}
fn foo_design_variables() {
    /*...*/
}

它们只需调用

cargo test foo

Which 将运行名称中包含 foo 的所有测试,调用这两个测试
两个测试都是同步进行的,这是默认行为,但显然需要更多的深思熟虑。

Unfortunately, there are only two ways of getting the behavior you specified, neither of them great. You could type

cargo test builtin_functions && cargo test design_variables

,effectively calling the function twice
or you could add an apparently arbitrary prefix that only these two tests would have before you run them, such as

fn foo_builtin_functions {
   /*...*/
}
fn foo_design_variables() {
    /*...*/
}

and them simply call

cargo test foo

Which would run all tests that contain foo in their name calling both
both tests synchronously, as is the default behavior, but obviously requires more forethought.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文