Skip to content

Commit 25ce4d7

Browse files
committed
Fix tests
1 parent f012eda commit 25ce4d7

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

crates/languages/src/rust.rs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ struct CargoTarget {
645645
src_path: String,
646646
}
647647

648-
#[derive(PartialEq)]
648+
#[derive(Debug, PartialEq)]
649649
enum TargetKind {
650650
Bin,
651651
Example,
@@ -1118,14 +1118,28 @@ mod tests {
11181118
(
11191119
r#"{"packages":[{"id":"path+file:///path/to/zed/crates/zed#0.131.0","targets":[{"name":"zed","kind":["bin"],"src_path":"/path/to/zed/src/main.rs"}]}]}"#,
11201120
"/path/to/zed/src/main.rs",
1121-
Some(("path+file:///path/to/zed/crates/zed#0.131.0", "zed")),
1121+
Some((
1122+
"path+file:///path/to/zed/crates/zed#0.131.0",
1123+
"zed",
1124+
TargetKind::Bin,
1125+
)),
11221126
),
11231127
(
11241128
r#"{"packages":[{"id":"path+file:///path/to/custom-package#[email protected]","targets":[{"name":"my-custom-bin","kind":["bin"],"src_path":"/path/to/custom-package/src/main.rs"}]}]}"#,
11251129
"/path/to/custom-package/src/main.rs",
11261130
Some((
11271131
"path+file:///path/to/custom-package#[email protected]",
11281132
"my-custom-bin",
1133+
TargetKind::Bin,
1134+
)),
1135+
),
1136+
(
1137+
r#"{"packages":[{"id":"path+file:///path/to/custom-package#[email protected]","targets":[{"name":"my-custom-bin","kind":["example"],"src_path":"/path/to/custom-package/src/main.rs"}]}]}"#,
1138+
"/path/to/custom-package/src/main.rs",
1139+
Some((
1140+
"path+file:///path/to/custom-package#[email protected]",
1141+
"my-custom-bin",
1142+
TargetKind::Example,
11291143
)),
11301144
),
11311145
(
@@ -1140,7 +1154,7 @@ mod tests {
11401154

11411155
assert_eq!(
11421156
retrieve_package_id_and_bin_name_from_metadata(metadata, absolute_path),
1143-
expected.map(|(pkgid, bin)| (pkgid.to_owned(), bin.to_owned()))
1157+
expected.map(|(pkgid, name, kind)| (pkgid.to_owned(), bin.to_owned(), kind))
11441158
);
11451159
}
11461160
}

0 commit comments

Comments
 (0)