Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
osiewicz committed Dec 2, 2024
1 parent f012eda commit 25ce4d7
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions crates/languages/src/rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ struct CargoTarget {
src_path: String,
}

#[derive(PartialEq)]
#[derive(Debug, PartialEq)]
enum TargetKind {
Bin,
Example,
Expand Down Expand Up @@ -1118,14 +1118,28 @@ mod tests {
(
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"}]}]}"#,
"/path/to/zed/src/main.rs",
Some(("path+file:///path/to/zed/crates/zed#0.131.0", "zed")),
Some((
"path+file:///path/to/zed/crates/zed#0.131.0",
"zed",
TargetKind::Bin,
)),
),
(
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"}]}]}"#,
"/path/to/custom-package/src/main.rs",
Some((
"path+file:///path/to/custom-package#[email protected]",
"my-custom-bin",
TargetKind::Bin,
)),
),
(
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"}]}]}"#,
"/path/to/custom-package/src/main.rs",
Some((
"path+file:///path/to/custom-package#[email protected]",
"my-custom-bin",
TargetKind::Example,
)),
),
(
Expand All @@ -1140,7 +1154,7 @@ mod tests {

assert_eq!(
retrieve_package_id_and_bin_name_from_metadata(metadata, absolute_path),
expected.map(|(pkgid, bin)| (pkgid.to_owned(), bin.to_owned()))
expected.map(|(pkgid, name, kind)| (pkgid.to_owned(), bin.to_owned(), kind))
);
}
}
Expand Down

0 comments on commit 25ce4d7

Please sign in to comment.