mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00
parent
6248ebe5b2
commit
03ccdd8169
@ -30,6 +30,10 @@ pub fn to_manifest(contents: &[u8],
|
||||
Some(ref toml) => add_unused_keys(&mut manifest, toml, "".to_string()),
|
||||
None => {}
|
||||
}
|
||||
if manifest.get_targets().len() == 0 {
|
||||
return Err(human(format!("either a [[lib]] or [[bin]] section must \
|
||||
be present")))
|
||||
}
|
||||
return Ok((manifest, paths));
|
||||
|
||||
fn add_unused_keys(m: &mut Manifest, toml: &toml::Value, key: String) {
|
||||
|
@ -766,3 +766,19 @@ test!(ignore_broken_symlinks {
|
||||
process(p.bin("foo")),
|
||||
execs().with_stdout("i am foo\n"));
|
||||
})
|
||||
|
||||
test!(missing_lib_and_bin {
|
||||
let mut p = project("foo");
|
||||
p = p
|
||||
.file("Cargo.toml", r#"
|
||||
[package]
|
||||
|
||||
name = "test"
|
||||
version = "0.0.0"
|
||||
authors = []
|
||||
"#);
|
||||
assert_that(p.cargo_process("cargo-build"),
|
||||
execs().with_status(101)
|
||||
.with_stderr("either a [[lib]] or [[bin]] section \
|
||||
must be present\n"));
|
||||
})
|
||||
|
@ -493,6 +493,10 @@ test!(error_message_for_missing_manifest {
|
||||
[dependencies.bar]
|
||||
|
||||
path = "src/bar"
|
||||
|
||||
[[lib]]
|
||||
|
||||
name = "foo"
|
||||
"#)
|
||||
.file("src/bar/not-a-manifest", "");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user