-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #2670 - matklad:simplify-tests, r=alexcrichton
Simplify tests @alexcrichton I think there is one bit of tests that could be simplified. What do you think about writing this ```Rust test!(simple { pkg("foo", "0.0.1"); assert_that(cargo_process("install").arg("foo"), execs().with_status(0).with_stdout(&format!("\ [UPDATING] registry `[..]` [DOWNLOADING] foo v0.0.1 (registry file://[..]) [COMPILING] foo v0.0.1 (registry file://[..]) [INSTALLING] {home}[..]bin[..]foo[..] ", home = cargo_home().display()))); assert_that(cargo_home(), has_installed_exe("foo")); assert_that(cargo_process("uninstall").arg("foo"), execs().with_status(0).with_stdout(&format!("\ [REMOVING] {home}[..]bin[..]foo[..] ", home = cargo_home().display()))); assert_that(cargo_home(), is_not(has_installed_exe("foo"))); }); ``` instead of this ```Rust test!(simple { pkg("foo", "0.0.1"); assert_that(cargo_process("install").arg("foo"), execs().with_status(0).with_stdout(&format!("\ {updating} registry `[..]` {downloading} foo v0.0.1 (registry file://[..]) {compiling} foo v0.0.1 (registry file://[..]) {installing} {home}[..]bin[..]foo[..] ", updating = UPDATING, downloading = DOWNLOADING, compiling = COMPILING, installing = INSTALLING, home = cargo_home().display()))); assert_that(cargo_home(), has_installed_exe("foo")); assert_that(cargo_process("uninstall").arg("foo"), execs().with_status(0).with_stdout(&format!("\ {removing} {home}[..]bin[..]foo[..] ", removing = REMOVING, home = cargo_home().display()))); assert_that(cargo_home(), is_not(has_installed_exe("foo"))); }); ``` This PR has a proof of concept implementation of this feature applied to a couple of tests. r? @alexcrichton
- Loading branch information
Showing
35 changed files
with
1,258 additions
and
1,504 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.