我正在写一个测试:
#[cfg(test)]
mod tests {
#[test]
fn test_something() {
//content of test function
}
}
Run Code Online (Sandbox Code Playgroud)
是否可以让这个测试在使用Windows时不运行而只在Linux上运行?
您可以选择根本不编译测试
#[cfg(not(target_os = "windows"))]
#[test]
fn test_something() {
//content of test function
}
Run Code Online (Sandbox Code Playgroud)
或者您可以选择编译它但不运行它:
#[test]
#[cfg_attr(target_os = "windows", ignore)]
fn test_something() {
//content of test function
}
Run Code Online (Sandbox Code Playgroud)
也可以看看:
| 归档时间: |
|
| 查看次数: |
931 次 |
| 最近记录: |