-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify tests #2670
Simplify tests #2670
Conversation
Sounds good to me! I like the idea of making these more ergonomic :) |
Wanna tackle some more as part of this? |
Not sure what did you mean by this :( I want to change all the tests and probably to get rid of those |
Ah yeah that's all I mean, applying this treatment to more tests. And yeah so long as the tests don't take days it's fine by me :) |
Ok, I've removed about a third of this formatting constants. I hope to continue this work tomorrow, but it might be a good idea to merge the current work:
|
I'd be fine with an incremental approach, but looks like tidy is failing? |
remove RUNNING, COMPILING, ERROR, DOCUMENTING, FRESH and UPDATING constants
Ah, I've just And indeed I am afraid that I can introduce a bit of bad formatting, because most changes here are done via regex search/replace (no structural search/replace in IntelliJ-Rust yet :( ). But in my opinion these tests are not exactly beautiful anyway :) |
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
☀️ Test successful - cargo-cross-linux, cargo-linux-32, cargo-linux-64, cargo-mac-32, cargo-mac-64, cargo-win-gnu-32, cargo-win-gnu-64, cargo-win-msvc-32, cargo-win-msvc-64 |
Simplify more tests This is the followup of #2670 It contains [one](28887be#diff-ebcf8bfb935037902f135a7c225479b5L322) more or less significant change, everything else is just search/replace. r? @alexcrichton
@alexcrichton I think there is one bit of tests that could be simplified.
What do you think about writing this
instead of this
This PR has a proof of concept implementation of this feature applied to a couple of tests.
r? @alexcrichton