Handle multiple binaries in one crate

This commit is contained in:
Dave Rolsky
2023-12-10 11:03:10 -06:00
parent 9fb7236944
commit c507aeb1b5
6 changed files with 43 additions and 10 deletions

View File

@@ -3,4 +3,14 @@ name = "test-project"
version = "0.1.0"
edition = "2021"
[dependencies]
# For testing it would be nice to create a binary with spaces in the name, but
# right now the `name` value must be a valid crate name, and there's no
# separate setting for the compiled executable's name. See
# https://github.com/rust-lang/cargo/issues/9778.
[[bin]]
name = "bin1"
path = "src/bin1.rs"
[[bin]]
name = "bin2"
path = "src/bin2.rs"

11
test-project/src/bin2.rs Normal file
View File

@@ -0,0 +1,11 @@
fn main() {
println!("Hello, world!");
}
#[cfg(test)]
mod test {
#[test]
fn test_something() {
assert_eq!(1, 1);
}
}