Skip to content

Commit 81c1147

Browse files
committed
Add more complex project-model test
1 parent b3919ea commit 81c1147

File tree

3 files changed

+1584
-1
lines changed

3 files changed

+1584
-1
lines changed

crates/project-model/src/tests.rs

+15-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::{
55

66
use base_db::{CrateGraph, FileId, ProcMacroPaths};
77
use cfg::{CfgAtom, CfgDiff};
8-
use expect_test::{expect, Expect};
8+
use expect_test::{expect, expect_file, Expect, ExpectFile};
99
use paths::{AbsPath, AbsPathBuf};
1010
use serde::de::DeserializeOwned;
1111

@@ -114,6 +114,11 @@ fn check_crate_graph(crate_graph: CrateGraph, expect: Expect) {
114114
replace_root(&mut crate_graph, false);
115115
expect.assert_eq(&crate_graph);
116116
}
117+
fn check_crate_graph_f(crate_graph: CrateGraph, expect: ExpectFile) {
118+
let mut crate_graph = format!("{crate_graph:#?}");
119+
replace_root(&mut crate_graph, false);
120+
expect.assert_eq(&crate_graph);
121+
}
117122

118123
#[test]
119124
fn cargo_hello_world_project_model_with_wildcard_overrides() {
@@ -1800,3 +1805,12 @@ fn rust_project_is_proc_macro_has_proc_macro_dep() {
18001805
// on the proc_macro sysroot crate.
18011806
crate_data.dependencies.iter().find(|&dep| dep.name.deref() == "proc_macro").unwrap();
18021807
}
1808+
1809+
#[test]
1810+
fn cargo_dev_dependencies() {
1811+
let (crate_graph, _proc_macros) = load_cargo("complex-with-dev-deps.json");
1812+
check_crate_graph_f(
1813+
crate_graph,
1814+
expect_file!["../test_data/cargo_dev_dependencies-crate-graph.txt"],
1815+
)
1816+
}

0 commit comments

Comments
 (0)