You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a test package that depends on its parent package. The test code thus depends on the parent package. It seems that compiletest-rs doesn't use the dependencies in Cargo.toml, and I'm trying to figure out another solution.
I'm creating a proc_macro, and tried to test compilation fails with trybuild but ran into this issue. Now I'm trying to do something similar with compiletest-rs, but I can't get it to work. I have the following package structure:
const_typed_builder_test/src/Cargo.toml includes this line:
[dependencies] # First I tried dev-dependencies but I get that that might not workconst_typed_builder = { path = "../../const_typed_builder", version = "=0.1.1" }
In const_typed_builder_test/src/lib.rs I have the following test
#[test]fncompile_fail_tests(){letmut config = compiletest_rs::Config::default();
config.mode = compiletest_rs::common::Mode::CompileFail;
config.src_base = std::path::PathBuf::from("./compile_fail");// config.run_lib_path = std::path::PathBuf::from(concat!(env!("CARGO_MANIFEST_DIR"),"../../target/")); // <-- I'm not sure what I was doing with this
config.link_deps();// Populate config.target_rustcflags with dependencies on the path
config.clean_rmeta();// If your tests import the parent crate, this helps with E0464
compiletest_rs::run_tests(&config);}
In const_typed_builder_test/compile_fail/simple_mandatory_1.rs I have this code:
use const_typed_builder::Builder;fnmain(){#[derive(Debug,Default,PartialEq,Eq,Builder)]#[builder(assume_mandatory)]pubstructFoo{bar:Option<String>,}let foo = Foo::builder().bar(Some("Hello world!".to_string())).build();//~ ERROR E0599}
I have a test package that depends on its parent package. The test code thus depends on the parent package. It seems that compiletest-rs doesn't use the dependencies in Cargo.toml, and I'm trying to figure out another solution.
I'm creating a proc_macro, and tried to test compilation fails with trybuild but ran into this issue. Now I'm trying to do something similar with compiletest-rs, but I can't get it to work. I have the following package structure:
const_typed_builder_test/src/Cargo.toml
includes this line:In
const_typed_builder_test/src/lib.rs
I have the following testIn
const_typed_builder_test/compile_fail/simple_mandatory_1.rs
I have this code:Which is run by
And the first unexpected error I get is
"1:5: 1:24: unresolved import
const_typed_builder[E0432]"
The text was updated successfully, but these errors were encountered: