That may work on linux and fail on windows, so it's better to proactively verify it.
").unwrap();
}
"#);
- assert_that(p.cargo_process("run"),
+ p.build();
+
+ assert_that(p.cargo("run"),
execs().with_status(0)
.with_stderr("\
[COMPILING] foo v0.5.0 (file://[..])
Hello, World!
"));
- assert_that(p.cargo_process("test"),
+ assert_that(p.cargo("test"),
execs().with_status(0));
}
let p = project("foo")
.file("Cargo.toml", &basic_bin_manifest("foo"))
.file("src/foo.rs", &main_file(r#""i am foo""#, &[]));
+ p.build();
assert_that(
- p.cargo_process("build").arg("-v").env("CARGO_INCREMENTAL", "1"),
+ p.cargo("build").arg("-v").env("CARGO_INCREMENTAL", "1"),
execs().with_stderr_contains(
"[RUNNING] `rustc [..] -Zincremental=[..][/]target[/]debug[/]incremental`\n")
.with_status(0));
assert_that(
- p.cargo_process("test").arg("-v").env("CARGO_INCREMENTAL", "1"),
+ p.cargo("test").arg("-v").env("CARGO_INCREMENTAL", "1"),
execs().with_stderr_contains(
"[RUNNING] `rustc [..] -Zincremental=[..][/]target[/]debug[/]incremental`\n")
.with_status(0));
.file("examples/a.rs", r#"
fn main() { println!("example"); }
"#);
+ p.build();
- assert_that(p.cargo_process("build").arg("--bin").arg("bin.rs"),
+ assert_that(p.cargo("build").arg("--bin").arg("bin.rs"),
execs().with_status(101).with_stderr("\
[ERROR] no bin target named `bin.rs`"));
- assert_that(p.cargo_process("build").arg("--bin").arg("a.rs"),
+ assert_that(p.cargo("build").arg("--bin").arg("a.rs"),
execs().with_status(101).with_stderr("\
[ERROR] no bin target named `a.rs`
Did you mean `a`?"));
- assert_that(p.cargo_process("build").arg("--example").arg("example.rs"),
+ assert_that(p.cargo("build").arg("--example").arg("example.rs"),
execs().with_status(101).with_stderr("\
[ERROR] no example target named `example.rs`"));
- assert_that(p.cargo_process("build").arg("--example").arg("a.rs"),
+ assert_that(p.cargo("build").arg("--example").arg("a.rs"),
execs().with_status(101).with_stderr("\
[ERROR] no example target named `a.rs`
crate_type = ["dylib"]
"#)
.file("bar/src/lib.rs", "// hello");
+ p.build();
// No metadata on libbar since it's a dylib path dependency
- assert_that(p.cargo_process("build").arg("-v"),
+ assert_that(p.cargo("build").arg("-v"),
execs().with_status(0).with_stderr(&format!("\
[COMPILING] bar v0.0.1 ({url}/bar)
[RUNNING] `rustc --crate-name bar bar[/]src[/]lib.rs --crate-type dylib \
suffix = env::consts::DLL_SUFFIX,
)));
- assert_that(p.cargo_process("clean"), execs().with_status(0));
+ assert_that(p.cargo("clean"), execs().with_status(0));
// If you set the env-var, then we expect metadata on libbar
- assert_that(p.cargo_process("build").arg("-v").env("__CARGO_DEFAULT_LIB_METADATA", "1"),
+ assert_that(p.cargo("build").arg("-v").env("__CARGO_DEFAULT_LIB_METADATA", "1"),
execs().with_status(0).with_stderr(&format!("\
[COMPILING] bar v0.0.1 ({url}/bar)
[RUNNING] `rustc --crate-name bar bar[/]src[/]lib.rs --crate-type dylib \
authors = []
"#)
.file("bar/src/lib.rs", "");
+ p.build();
- assert_that(p.cargo_process("build"), execs().with_status(0));
- let p = p.file("Cargo.toml", r#"
- [package]
- name = "foo"
- version = "0.0.1"
- authors = []
- "#);
- assert_that(p.cargo_process("build"), execs().with_status(101));
+ assert_that(p.cargo("build"), execs().with_status(0));
+ p.change_file("Cargo.toml", r#"
+ [package]
+ name = "foo"
+ version = "0.0.1"
+ authors = []
+ "#);
+ assert_that(p.cargo("build"), execs().with_status(101));
}
#[test]
doctest = false
"#)
.file("d2/src/main.rs", "fn main() { println!(\"d2\"); }");
- p.build();
assert_that(p.cargo_process("build").arg("-p").arg("d1").arg("-p").arg("d2")
.arg("-p").arg("foo"),
.file("d1/src/main.rs", "fn main() { println!(\"d1\"); }");
p.build();
- assert_that(p.cargo_process("build").arg("-p").arg("notAValidDep"),
+ assert_that(p.cargo("build").arg("-p").arg("notAValidDep"),
execs().with_status(101).with_stderr("\
[ERROR] package id specification `notAValidDep` matched no packages
"));
- assert_that(p.cargo_process("build").arg("-p").arg("d1").arg("-p").arg("notAValidDep"),
+ assert_that(p.cargo("build").arg("-p").arg("d1").arg("-p").arg("notAValidDep"),
execs().with_status(101).with_stderr("\
[ERROR] package id specification `notAValidDep` matched no packages
"));
#[test]
fn explicit_color_config_is_propagated_to_rustc() {
- let mut p = project("foo");
- p = p
- .file("Cargo.toml", r#"
- [package]
-
- name = "test"
- version = "0.0.0"
- authors = []
- "#)
- .file("src/lib.rs", "");
+ let p = project("foo")
+ .file("Cargo.toml", r#"
+ [package]
- assert_that(p.cargo_process("build").arg("-v").arg("--color").arg("always"),
+ name = "test"
+ version = "0.0.0"
+ authors = []
+ "#)
+ .file("src/lib.rs", "");
+ p.build();
+ assert_that(p.cargo("build").arg("-v").arg("--color").arg("always"),
execs().with_status(0).with_stderr_contains(
"[..]rustc [..] src[/]lib.rs --color always[..]"));
- assert_that(p.cargo_process("build").arg("-v").arg("--color").arg("never"),
+ assert_that(p.cargo("clean"), execs().with_status(0));
+
+ assert_that(p.cargo("build").arg("-v").arg("--color").arg("never"),
execs().with_status(0).with_stderr("\
[COMPILING] test v0.0.0 ([..])
[RUNNING] `rustc [..] --color never [..]`
let p = project("foo")
.file("Cargo.toml", &basic_bin_manifest("foo"))
.file("src/main.rs", "fn main() {}");
- p.build();
assert_that(p.cargo_process("build").arg("--message-format").arg("XML"),
execs().with_status(1)
let p = project("foo")
.file("Cargo.toml", &basic_bin_manifest("foo"))
.file("src/main.rs", "fn main() {}");
- p.build();
assert_that(p.cargo_process("build").arg("--target").arg(""),
execs().with_status(101)
.file("bar/src/lib.rs", r#"
pub fn bar() {}
"#);
- p.build();
assert_that(p.cargo_process("build")
.arg("--all"),
.file("bar/src/lib.rs", r#"
pub fn bar() {}
"#);
- p.build();
// The order in which foo and bar are built is not guaranteed
assert_that(p.cargo_process("build")
.file("a/src/lib.rs", r#"
pub fn a() {}
"#);
- p.build();
Package::new("a", "0.1.0").publish();
+use std::cell::Cell;
use std::env;
use std::error::Error;
use std::ffi::OsStr;
name: String,
root: PathBuf,
files: Vec<FileBuilder>,
- symlinks: Vec<SymlinkBuilder>
+ symlinks: Vec<SymlinkBuilder>,
+ is_build: Cell<bool>,
}
impl ProjectBuilder {
name: name.to_string(),
root: root,
files: vec![],
- symlinks: vec![]
+ symlinks: vec![],
+ is_build: Cell::new(false),
}
}
}
pub fn cargo(&self, cmd: &str) -> ProcessBuilder {
+ assert!(self.is_build.get(),
+ "call `.build()` before calling `.cargo()`, \
+ or use `.cargo_process()`");
let mut p = self.process(&cargo_dir().join("cargo"));
p.arg(cmd);
return p;
self
}
+ pub fn change_file(&self, path: &str, body: &str) {
+ assert!(self.is_build.get());
+ FileBuilder::new(self.root.join(path), body).mk()
+ }
+
pub fn symlink<T: AsRef<Path>>(mut self, dst: T,
src: T) -> ProjectBuilder {
self.symlinks.push(SymlinkBuilder::new(self.root.join(dst),
// TODO: return something different than a ProjectBuilder
pub fn build(&self) -> &ProjectBuilder {
+ assert!(!self.is_build.get(),
+ "can `.build()` project only once");
+ self.is_build.set(true);
// First, clean the directory if it already exists
self.rm_root();
::bar::baz();
}
"#);
+ foo.build();
+
let bar = project("bar")
.file("Cargo.toml", r#"
[package]
"#);
bar.build();
- assert_that(foo.cargo_process("check"),
+ assert_that(foo.cargo("check"),
execs().with_status(0));
- assert_that(foo.cargo_process("build"),
+ assert_that(foo.cargo("build"),
execs().with_status(0));
}
::bar::baz();
}
"#);
+ foo.build();
+
let bar = project("bar")
.file("Cargo.toml", r#"
[package]
"#);
bar.build();
- assert_that(foo.cargo_process("build"),
+ assert_that(foo.cargo("build"),
execs().with_status(0));
- assert_that(foo.cargo_process("check"),
+ assert_that(foo.cargo("check"),
execs().with_status(0));
}
"#)
.file("src/lib.rs", "")
.file("src/main.rs", "fn main() {}");
- foo.build();
assert_that(foo.cargo_process("check").arg("-v"),
execs().with_status(0)
name = "d2"
"#)
.file("d2/src/main.rs", "fn main() { println!(\"d2\"); }");
- p.build();
assert_that(p.cargo_process("build").arg("-p").arg("d1").arg("-p").arg("d2")
.arg("-p").arg("foo"),
.file("a/src/lib.rs", "");
p.build();
- assert_that(p.cargo_process("build").arg("--release"),
+ assert_that(p.cargo("build").arg("--release"),
execs().with_status(0));
assert_that(p.cargo("clean").arg("-p").arg("foo"),
.file("a/src/lib.rs", "");
p.build();
- assert_that(p.cargo_process("build").env("FIRST", "1"),
+ assert_that(p.cargo("build").env("FIRST", "1"),
execs().with_status(0));
assert_that(p.cargo("clean").arg("-p").arg("foo"),
execs().with_status(0));
.file("src/main.rs", "fn main() {}");
p.build();
- assert_that(p.cargo_process("build"),
+ assert_that(p.cargo("build"),
execs().with_status(0));
assert_that(p.cargo("clean").arg("-p").arg("dep"),
execs().with_status(0).with_stdout(""));
Package::new("bar", "0.1.0").publish();
- assert_that(p.cargo_process("build"),
+ assert_that(p.cargo("build"),
execs().with_status(0));
assert_that(p.cargo("clean").arg("-p").arg("bar"),
execs().with_status(0).with_stdout(""));
//! assert!(true);
//! ```
"#);
+ p.build();
let host_output = format!("\
[COMPILING] foo v0.0.0 ({foo})
", foo = p.url());
println!("a");
- assert_that(p.cargo_process("test"),
+ assert_that(p.cargo("test"),
execs().with_status(0)
.with_stderr(&host_output));
println!("b");
let target = host();
- assert_that(p.cargo_process("test").arg("--target").arg(&target),
+ assert_that(p.cargo("test").arg("--target").arg(&target),
execs().with_status(0)
.with_stderr(&format!("\
[COMPILING] foo v0.0.0 ({foo})
println!("c");
let target = alternate();
- assert_that(p.cargo_process("test").arg("--target").arg(&target),
+ assert_that(p.cargo("test").arg("--target").arg(&target),
execs().with_status(0)
.with_stderr(&format!("\
[COMPILING] foo v0.0.0 ({foo})
fn main() { println!("cargo:val=1") }
"#)
.file("d2/src/lib.rs", "");
+ p.build();
- assert_that(p.cargo_process("build").arg("-v"), execs().with_status(0));
- assert_that(p.cargo_process("build").arg("-v").arg("--target").arg(&target),
+ assert_that(p.cargo("build").arg("-v"), execs().with_status(0));
+ assert_that(p.cargo("build").arg("-v").arg("--target").arg(&target),
execs().with_status(0));
}
/// dox
pub fn foo() {}
"#);
- assert_that(p.cargo_process("doc"),
+ p.build();
+
+ assert_that(p.cargo("doc"),
execs().with_status(0));
assert_that(&p.root().join("target/doc/foo/index.html"), existing_file());
fs::remove_dir_all(p.root().join("target/doc/foo")).unwrap();
- assert_that(p.cargo_process("doc"),
+ assert_that(p.cargo("doc"),
execs().with_status(0));
assert_that(&p.root().join("target/doc/foo/index.html"), existing_file());
}
.file("bar/src/lib.rs", r#"
pub fn bar() {}
"#);
- p.build();
// The order in which bar is compiled or documented is not deterministic
assert_that(p.cargo_process("doc")
.file("bar/src/lib.rs", r#"
pub fn bar() {}
"#);
- p.build();
// The order in which foo and bar are documented is not guaranteed
assert_that(p.cargo_process("doc")
.file("a/src/lib.rs", r#"
pub fn a() {}
"#);
- p.build();
Package::new("a", "0.1.0").publish();
authors = []
"#)
.file("bar/src/lib.rs", "");
+ p.build();
- assert_that(p.cargo_process("build"),
+ assert_that(p.cargo("build"),
execs().with_status(101).with_stderr("\
[ERROR] Package `bar v0.0.1 ([..])` does not have these features: `bar`
"));
- let p = p.file("Cargo.toml", r#"
- [project]
- name = "foo"
- version = "0.0.1"
- authors = []
- "#);
+ p.change_file("Cargo.toml", r#"
+ [project]
+ name = "foo"
+ version = "0.0.1"
+ authors = []
+ "#);
- assert_that(p.cargo_process("build").arg("--features").arg("test"),
+ assert_that(p.cargo("build").arg("--features").arg("test"),
execs().with_status(101).with_stderr("\
[ERROR] Package `foo v0.0.1 ([..])` does not have these features: `test`
"));
#[cfg(feature = "some-feat")]
pub fn test() { print!("test"); }
"#);
+ p.build();
// The foo project requires that feature "some-feat" in "bar" is enabled.
// Building without any features enabled should fail:
- assert_that(p.cargo_process("build"),
+ assert_that(p.cargo("build"),
execs().with_status(101));
// We should be able to enable the feature "derived-feat", which enables "some-feat",
// on the command line. The feature is enabled, thus building should be successful:
- assert_that(p.cargo_process("build").arg("--features").arg("derived/derived-feat"),
+ assert_that(p.cargo("build").arg("--features").arg("derived/derived-feat"),
execs().with_status(0));
// Trying to enable features of transitive dependencies is an error
- assert_that(p.cargo_process("build").arg("--features").arg("bar/some-feat"),
+ assert_that(p.cargo("build").arg("--features").arg("bar/some-feat"),
execs().with_status(101).with_stderr("\
[ERROR] Package `foo v0.0.1 ([..])` does not have these features: `bar`
"));
// Hierarchical feature specification should still be disallowed
- assert_that(p.cargo_process("build").arg("--features").arg("derived/bar/some-feat"),
+ assert_that(p.cargo("build").arg("--features").arg("derived/bar/some-feat"),
execs().with_status(101).with_stderr("\
[ERROR] feature names may not contain slashes: `bar/some-feat`
"));
.file("bar/src/lib.rs", "")
.file("baz/Cargo.toml", &basic_lib_manifest("baz"))
.file("baz/src/lib.rs", "");
- p.build();
assert_that(p.cargo_process("metadata"), execs().with_status(0).with_json(r#"
{
.file("bar/src/lib.rs", "")
.file("baz/Cargo.toml", &basic_lib_manifest("baz"))
.file("baz/src/lib.rs", "");
- p.build();
assert_that(p.cargo_process("metadata").arg("--no-deps"), execs().with_status(0).with_json(r#"
{
extern crate tar;
extern crate cargo;
-use std::fs::{File, OpenOptions};
+use std::fs::File;
use std::io::prelude::*;
use std::path::{Path, PathBuf};
#[test]
fn do_not_package_if_repository_is_dirty() {
+ let p = project("foo");
+ p.build();
+
// Create a Git repository containing a minimal Rust project.
git::repo(&paths::root().join("foo"))
.file("Cargo.toml", r#"
.build();
// Modify Cargo.toml without committing the change.
- let p = project("foo");
- let manifest_path = p.root().join("Cargo.toml");
- let mut manifest = t!(OpenOptions::new().append(true).open(manifest_path));
- t!(writeln!(manifest, ""));
+ p.change_file("Cargo.toml", r#"
+ [project]
+ name = "foo"
+ version = "0.0.1"
+ license = "MIT"
+ description = "foo"
+ documentation = "foo"
+ homepage = "foo"
+ repository = "foo"
+ # change
+ "#);
assert_that(p.cargo("package"),
execs().with_status(101)
#[test]
fn no_rebuild_dependency() {
- let mut p = project("foo");
- p = p
+ let p = project("foo")
.file("Cargo.toml", r#"
[project]
// This time we shouldn't compile bar
assert_that(p.cargo("build"),
execs().with_stdout(""));
- p.root().move_into_the_past();
-
- p.build(); // rebuild the files (rewriting them in the process)
- assert_that(p.cargo("build"),
- execs().with_stderr(&format!("[COMPILING] bar v0.5.0 ({}/bar)\n\
- [COMPILING] foo v0.5.0 ({})\n\
- [FINISHED] dev [unoptimized + debuginfo] target(s) \
- in [..]\n",
- p.url(),
- p.url())));
}
#[test]
assert!(true);
}
"#);
- foo.build();
assert_that(foo.cargo_process("test"),
execs().with_status(0)
opt-level = 1
"#)
.file("bar/src/main.rs", "fn main() {}");
- p.build();
assert_that(p.cargo_process("build").cwd(p.root().join("bar")).arg("-v"),
execs().with_status(0).with_stderr("\
workspace = ".."
"#)
.file("bar/src/main.rs", "fn main() {}");
- p.build();
assert_that(p.cargo_process("build").cwd(p.root().join("bar")).arg("-v"),
execs().with_status(0).with_stderr("\
#[test]
fn dont_publish_dirty() {
setup();
+ let p = project("foo")
+ .file("bar", "");
+ p.build();
repo(&paths::root().join("foo"))
.file("Cargo.toml", r#"
.file("src/main.rs", "fn main() {}")
.build();
- let p = project("foo");
- t!(File::create(p.root().join("bar")));
assert_that(p.cargo("publish")
.arg("--host").arg(registry().to_string()),
execs().with_status(101).with_stderr("\
fn publish_clean() {
setup();
+ let p = project("foo");
+ p.build();
+
repo(&paths::root().join("foo"))
.file("Cargo.toml", r#"
[project]
.file("src/main.rs", "fn main() {}")
.build();
- let p = project("foo");
assert_that(p.cargo("publish")
.arg("--host").arg(registry().to_string()),
execs().with_status(0));
fn publish_in_sub_repo() {
setup();
+ let p = project("foo")
+ .file("baz", "");
+ p.build();
+
repo(&paths::root().join("foo"))
.file("bar/Cargo.toml", r#"
[project]
.file("bar/src/main.rs", "fn main() {}")
.build();
- let p = project("foo");
- t!(File::create(p.root().join("baz")));
assert_that(p.cargo("publish").cwd(p.root().join("bar"))
.arg("--host").arg(registry().to_string()),
execs().with_status(0));
fn publish_when_ignored() {
setup();
+ let p = project("foo")
+ .file("baz", "");
+ p.build();
+
repo(&paths::root().join("foo"))
.file("Cargo.toml", r#"
[project]
.file(".gitignore", "baz")
.build();
- let p = project("foo");
- t!(File::create(p.root().join("baz")));
assert_that(p.cargo("publish")
.arg("--host").arg(registry().to_string()),
execs().with_status(0));
fn ignore_when_crate_ignored() {
setup();
+ let p = project("foo")
+ .file("bar/baz", "");
+ p.build();
+
repo(&paths::root().join("foo"))
.file(".gitignore", "bar")
.nocommit_file("bar/Cargo.toml", r#"
repository = "foo"
"#)
.nocommit_file("bar/src/main.rs", "fn main() {}");
- let p = project("foo");
- t!(File::create(p.root().join("bar/baz")));
assert_that(p.cargo("publish").cwd(p.root().join("bar"))
.arg("--host").arg(registry().to_string()),
execs().with_status(0));
fn new_crate_rejected() {
setup();
+ let p = project("foo")
+ .file("baz", "");
+ p.build();
+
repo(&paths::root().join("foo"))
.nocommit_file("Cargo.toml", r#"
[project]
repository = "foo"
"#)
.nocommit_file("src/main.rs", "fn main() {}");
- let p = project("foo");
- t!(File::create(p.root().join("baz")));
assert_that(p.cargo("publish")
.arg("--host").arg(registry().to_string()),
execs().with_status(101));
bar = ">= 0.0.0"
"#)
.file("src/main.rs", "fn main() {}");
+ p.build();
Package::new("bar", "0.0.1").publish();
- assert_that(p.cargo_process("build"),
+ assert_that(p.cargo("build"),
execs().with_status(0).with_stderr(&format!("\
[UPDATING] registry `{reg}`
[DOWNLOADING] bar v0.0.1 (registry file://[..])
dir = p.url(),
reg = registry::registry())));
+ assert_that(p.cargo("clean"), execs().with_status(0));
+
// Don't download a second time
- assert_that(p.cargo_process("build"),
+ assert_that(p.cargo("build"),
execs().with_status(0).with_stderr(&format!("\
-[UPDATING] registry `{reg}`
[COMPILING] bar v0.0.1
[COMPILING] foo v0.0.1 ({dir})
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..] secs
",
- dir = p.url(),
- reg = registry::registry())));
+ dir = p.url())));
}
#[test]
foo = ">= 1.0.0"
"#)
.file("src/main.rs", "fn main() {}");
+ p.build();
Package::new("foo", "0.0.1").publish();
Package::new("foo", "0.0.2").publish();
- assert_that(p.cargo_process("build"),
+ assert_that(p.cargo("build"),
execs().with_status(101).with_stderr_contains("\
[ERROR] no matching package named `foo` found (required by `foo`)
location searched: registry [..]
Package::new("foo", "0.0.3").publish();
Package::new("foo", "0.0.4").publish();
- assert_that(p.cargo_process("build"),
+ assert_that(p.cargo("build"),
execs().with_status(101).with_stderr_contains("\
[ERROR] no matching package named `foo` found (required by `foo`)
location searched: registry [..]
.file("examples/a.rs", r#"
fn main() { println!("example"); }
"#);
+ p.build();
- assert_that(p.cargo_process("run").arg("--bin").arg("bin.rs"),
+ assert_that(p.cargo("run").arg("--bin").arg("bin.rs"),
execs().with_status(101).with_stderr("\
[ERROR] no bin target named `bin.rs`"));
- assert_that(p.cargo_process("run").arg("--bin").arg("a.rs"),
+ assert_that(p.cargo("run").arg("--bin").arg("a.rs"),
execs().with_status(101).with_stderr("\
[ERROR] no bin target named `a.rs`
Did you mean `a`?"));
- assert_that(p.cargo_process("run").arg("--example").arg("example.rs"),
+ assert_that(p.cargo("run").arg("--example").arg("example.rs"),
execs().with_status(101).with_stderr("\
[ERROR] no example target named `example.rs`"));
- assert_that(p.cargo_process("run").arg("--example").arg("a.rs"),
+ assert_that(p.cargo("run").arg("--example").arg("a.rs"),
execs().with_status(101).with_stderr("\
[ERROR] no example target named `a.rs`
authors = []
"#)
.file("src/lib.rs", "");
+ p.build();
- assert_that(p.cargo_process("run").arg("--example").arg("foo"),
+ assert_that(p.cargo("run").arg("--example").arg("foo"),
execs().with_status(101).with_stderr("\
[ERROR] no example target named `foo`
"));
- assert_that(p.cargo_process("run").arg("--bin").arg("foo"),
+ assert_that(p.cargo("run").arg("--bin").arg("foo"),
execs().with_status(101).with_stderr("\
[ERROR] no bin target named `foo`
"));
authors = []
"#)
.file("libs/mock_serde_codegen/src/lib.rs", "");
+ p.build();
- assert_that(p.cargo_process("test")
+ assert_that(p.cargo("test")
.arg("--package").arg("feature_a")
.arg("--verbose"),
execs().with_status(0)
[DOCTEST] feature_a
[RUNNING] `rustdoc --test [..]mock_serde_codegen[..]`"));
- assert_that(p.cargo_process("test")
+ assert_that(p.cargo("test")
.arg("--verbose"),
execs().with_status(0)
.with_stderr_contains("\
authors = []
"#)
.file("a/src/lib.rs", "");
- p.build();
- assert_that(p.cargo("test").arg("-v")
+ assert_that(p.cargo_process("test").arg("-v")
.arg("-p").arg("a")
.arg("-p").arg("foo")
.arg("--features").arg("foo"),
#[test]
fn bar_test() {}
"#);
- p.build();
assert_that(p.cargo_process("test")
.arg("--all"),
#[test]
fn b() {}
"#);
- p.build();
assert_that(p.cargo_process("test")
.arg("--all"),
#[test]
fn a() {}
"#);
- p.build();
Package::new("a", "0.1.0").publish();
#[test]
fn simple() {
let p = project("foo");
+ p.build();
- assert_that(p.cargo_process("version"),
+ assert_that(p.cargo("version"),
execs().with_status(0).with_stdout(&format!("{}\n",
cargo::version())));
- assert_that(p.cargo_process("--version"),
+ assert_that(p.cargo("--version"),
execs().with_status(0).with_stdout(&format!("{}\n",
cargo::version())));