努力将集成测试包含到我的项目中,但我无法导入库。我认为新规则将允许我只写一个use
声明,但进展并不顺利:)
下面的代码显示了相关的组件。这不应该是有效的吗?
Cargo.toml
[package]
name = "myswankynewpackage"
version = "0.1.0"
authors = ["Me Myself <me.myself@gmail.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
tests/tests.rs
use myswankynewpackage;
// Also tried extern crate
// extern crate myswankynewpackage;
#[cfg(test)]
mod integration {
use super::*;
mod module{
#[test]
fn module_test() {
}
}
}
我收到一条错误消息,提示找不到箱子
error[E0432]: unresolved import `myswankynewpackage`
--> tests/tests.rs:1:5
|
1 | use myswankynewpackage;
| ^^^^^^^^^^^^^^^^^^ no `myswankynewpackage` external crate