From: Kalita Alexey Date: Wed, 18 Jan 2017 07:56:22 +0000 (+0300) Subject: Added tests for building an example as a library X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2~11^2~24^2~4 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=446985cf1aa4d9aaf905cbc037c908386d357dcf;p=cargo.git Added tests for building an example as a library --- diff --git a/tests/build.rs b/tests/build.rs index e4871a58d..c62513ebd 100644 --- a/tests/build.rs +++ b/tests/build.rs @@ -1890,6 +1890,82 @@ fn cargo_platform_specific_dependency_wrong_platform() { assert!(lockfile.contains("bar")) } +#[test] +fn example_as_lib() { + let p = project("foo") + .file("Cargo.toml", r#" + [package] + name = "foo" + version = "0.0.1" + authors = [] + + [[example]] + name = "ex" + crate-type = ["lib"] + "#) + .file("src/lib.rs", "") + .file("examples/ex.rs", ""); + + assert_that(p.cargo_process("build"), execs().with_status(0)); +} + +#[test] +fn example_as_rlib() { + let p = project("foo") + .file("Cargo.toml", r#" + [package] + name = "foo" + version = "0.0.1" + authors = [] + + [[example]] + name = "ex" + crate-type = ["rlib"] + "#) + .file("src/lib.rs", "") + .file("examples/ex.rs", ""); + + assert_that(p.cargo_process("build"), execs().with_status(0)); +} + +#[test] +fn example_as_dylib() { + let p = project("foo") + .file("Cargo.toml", r#" + [package] + name = "foo" + version = "0.0.1" + authors = [] + + [[example]] + name = "ex" + crate-type = ["dylib"] + "#) + .file("src/lib.rs", "") + .file("examples/ex.rs", ""); + + assert_that(p.cargo_process("build"), execs().with_status(0)); +} + +#[test] +fn example_as_proc_macro() { + let p = project("foo") + .file("Cargo.toml", r#" + [package] + name = "foo" + version = "0.0.1" + authors = [] + + [[example]] + name = "ex" + crate-type = ["proc-macro"] + "#) + .file("src/lib.rs", "") + .file("examples/ex.rs", ""); + + assert_that(p.cargo_process("build"), execs().with_status(0)); +} + #[test] fn example_bin_same_name() { let p = project("foo")