Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/project-model/src/tests.rs')
| -rw-r--r-- | crates/project-model/src/tests.rs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/crates/project-model/src/tests.rs b/crates/project-model/src/tests.rs index 3e5234afc8..3c0d53b26b 100644 --- a/crates/project-model/src/tests.rs +++ b/crates/project-model/src/tests.rs @@ -5,7 +5,7 @@ use std::{ use base_db::{CrateGraph, FileId, ProcMacroPaths}; use cfg::{CfgAtom, CfgDiff}; -use expect_test::{expect, Expect}; +use expect_test::{expect, expect_file, Expect, ExpectFile}; use paths::{AbsPath, AbsPathBuf}; use serde::de::DeserializeOwned; @@ -114,6 +114,11 @@ fn check_crate_graph(crate_graph: CrateGraph, expect: Expect) { replace_root(&mut crate_graph, false); expect.assert_eq(&crate_graph); } +fn check_crate_graph_f(crate_graph: CrateGraph, expect: ExpectFile) { + let mut crate_graph = format!("{crate_graph:#?}"); + replace_root(&mut crate_graph, false); + expect.assert_eq(&crate_graph); +} #[test] fn cargo_hello_world_project_model_with_wildcard_overrides() { @@ -1666,3 +1671,12 @@ fn rust_project_is_proc_macro_has_proc_macro_dep() { // on the proc_macro sysroot crate. crate_data.dependencies.iter().find(|&dep| dep.name.deref() == "proc_macro").unwrap(); } + +#[test] +fn cargo_dev_dependencies() { + let (crate_graph, _proc_macros) = load_cargo("complex-with-dev-deps.json"); + check_crate_graph_f( + crate_graph, + expect_file!["../test_data/cargo_dev_dependencies-crate-graph.txt"], + ) +} |