小编jsc*_*chw的帖子

我怎样才能只运行集成测试

有没有办法只运行集成测试而不运行单元测试?

我试过了:

cargo test --tests:运行单元+集成测试

cargo test --test test_name:运行一项指定的测试

目前是否无法仅运行集成测试,或者我是否遗漏了某些内容?

rust

18
推荐指数
1
解决办法
5007
查看次数

如何基于 cfg 有条件地启用 Rust 功能?

我想使用#![feature(custom_test_frameworks)],但如果可能,只能通过 有条件地启用它#[cfg(not(target_os = "custom_os_name"))]。我仍然希望可以选择使用 rusts libtest 在我的主机系统上直接运行一些测试,但显然我不允许通过cfg以下方式修改功能:

错误信息:

note: inner attributes, like `#![no_std]`, annotate the item enclosing them, 
and are usually found at the beginning of source files. Outer attributes, like 
`#[test]`, annotate the item following them.
Run Code Online (Sandbox Code Playgroud)

有没有其他方法可以有条件地启用“内部属性”?

conditional-compilation rust

5
推荐指数
1
解决办法
436
查看次数

标签 统计

rust ×2

conditional-compilation ×1