134 Commits

Author SHA1 Message Date
Eric Huss
1ce8023626 Rustfmt 2024 2025-07-05 19:50:36 -07:00
Ross Sullivan
92d9a94d02
chore: Migrated testsuite to testsuite::prelude 2025-06-25 22:37:24 +09:00
Ed Page
d29a7cb5d7 fix(run): Say what the multiple executables are 2025-03-11 13:15:54 -05:00
Ed Page
b06e29c72a fix(compile): Specify packages ambiguous targets come from 2025-03-11 13:02:55 -05:00
Ed Page
b20edd4226 fix(compile): Consistently use help prefix in errors 2025-03-11 11:54:00 -05:00
Ed Page
7bf7b2f684 fix(compile): Match rustc style guide for help message casing 2025-03-11 11:51:38 -05:00
Ed Page
fde91dde66 fix(compile): Remove trailing newlines on errors 2025-03-11 11:41:18 -05:00
Ed Page
c2764576ac fix(compile): Be consistent in not using period in error
Whether a period was used was dependent on whether a `help:` block is
present.
That shouldn't make a difference and the rustc dev guide says not to use
periods unless multiple sentences are used.
2025-03-11 11:41:08 -05:00
Ed Page
da833c55be test(run): Show ambiguous package name errors 2025-03-11 11:11:44 -05:00
Ed Page
92a5d5e56a test(run): Move run-focused test with rest 2025-03-11 11:07:39 -05:00
Yihai Lin
fa7712da82 feat: Make no target found hint more clear. 2025-02-28 10:03:59 +08:00
Ed Page
e78a8a19db fix: Align new help messages with their error 2025-02-04 10:46:09 -06:00
Ed Page
5408bd9f52 fix: Update generic 'did you meann' reports to not say that 2025-02-03 13:07:47 -06:00
Ed Page
d2ec764995 fix(resolve): Dont show locking workspace members
This is for `cargo generate-lockfile` and when syncing the lockfile with
the manifest.
We still show it for `cargo update` because of `cargo update
--workspace`.

We hacked around this previously by filtering out the `num_pkgs==1` case
for single packages but this didn't help with workspaces.
2024-08-22 16:57:06 -05:00
Ed Page
3a615ca9c8 feat(test): Add CargoPathExt to prelude 2024-07-18 15:22:29 -05:00
Ed Page
5b9799c6f4 refactor: Migrate from extern crate to test-support prelude
We now include the prelude in so many places, this simplifies how we can
present how `cargo-test-support` works.

Yes, this included some `use` clean ups but its already painful enough
walking through every test file, I didn't want to do it twice.
2024-07-12 15:57:00 -05:00
eth3lbert
913b12b8d4
test: migrate run to snapbox 2024-06-22 21:31:02 +08:00
Weihang Lo
4f002a5f46
Revert "Auto merge of #13630 - Kobzol:msvc-disable-release-strip, r=weihanglo"
This reverts commit fa619a9d16ca0d4dc58431808c08b7c1fee72bfa, reversing
changes made to 1f6857dcfbe84ce3e8edd26f861ee8bae0c5da2b.

See also <https://github.com/rust-lang/rust/pull/115120>
2024-06-13 12:21:13 -04:00
Ed Page
dc5ac62cab fix(test): Deprecate non-snapbox assertions
While this is noisy and hides other deprecations, I figured deprecations would
make it easier for people to discover what tasks remain and allow us to
divide and conquer this work rather than doing a heroic PR.
In theory, this will be short lived and we'll go back to seeing
deprecations in our tests.
2024-06-10 10:20:52 -05:00
Ed Page
f1caef11c4 test: Move off of deprecated manifest fields 2024-04-18 14:11:31 -05:00
Ed Page
1876326b6b feat(resolve): Tell the user the style of resovle done
This is to help with #9930

Example changes:
```diff
-[LOCKING] 4 packages
+[LOCKING] 4 packages to latest version
-[LOCKING] 2 packages
+[LOCKING] 2 packages to latest Rust 1.60.0 compatible versions
-[LOCKING] 2 packages
+[LOCKING] 2 packages to earliest versions
```

Benefits
- The package count is of "added" packages and this makes that more
  logically clear
- This gives users transparency into what is happening, especially with
  - what rust-version is use
  - the transition to this feature in the new edition
  - whether the planned config was applied or not (as I don't want it to
    require an MSRV bump)
- Will make it easier in tests to show what changed
- Provides more motiviation to show this message in `cargo update` and
  `cargo install` (that will be explored in a follow up PR)

This does come at the cost of more verbose output but hopefully not too
verbose.  This is why I left off other factors, like avoid-dev-deps.
2024-04-13 20:39:59 -05:00
Jakub Beránek
53a0dc4aa2
Fix tests 2024-03-25 23:42:47 +01:00
Ed Page
4ab2797f36 feat(lock): Print lockfile changes on all commands 2024-03-12 13:39:56 -05:00
Ed Page
14646e6af6 test: Make edition explicit on packages 2024-02-22 11:37:03 -06:00
Ed Page
831847e5f0 fix(rustc): Always pass --edition to rustc
On [Internals](https://internals.rust-lang.org/t/idea-rustc-cargo-should-warn-on-unspecified-edition/20309),
the idea came up for warning on unset Edition.
I am working on the cargo warning but if rustc ever wants to do so,
they'd be blocked on cargo ensuring `--edition` is always set.
Hence this change.
2024-02-28 15:35:41 -06:00
Ed Page
e7e8d8748a fix(compiler): Clarify we're showing a profile name 2024-02-08 14:01:39 -06:00
bors
8ed4cb1ec8 Auto merge of #13335 - hi-rustin:rustin-patch-same-name, r=weihanglo
fix: use spec id instead of name to match package
2024-01-30 13:25:13 +00:00
hi-rustin
7a13864f29 test: add a cannot find case
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2024-01-30 20:55:50 +08:00
hi-rustin
240020d546 fix: use spec id instead of name to match package
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2024-01-30 20:55:40 +08:00
Ed Page
675224b3a0 test(config): Shift to config.toml 2024-01-26 13:40:46 -06:00
hi-rustin
aa6444734d test: add a case for running binary with same name as dependency
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2024-01-22 21:06:32 +08:00
Jakub Beránek
e954099394
Update existing tests 2024-01-07 09:48:02 +01:00
hi-rustin
ed9dc44f47 Update other tests to use cargo:: syntax
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-12-23 13:17:55 +08:00
Ed Page
99f917a67e fix(help): Consistently use SCREAMING_CASE for value names
- We have some positional value names that are SCREAMING_CASE and some
  that aren't
- All of the value names for our flags are already SCREAMING_CASE
2023-10-17 16:47:44 -05:00
hi-rustin
44d955b15d Fix test on windows 2023-09-28 10:10:19 +08:00
hi-rustin
5d8009a189 Better suggestion for unsupported silent flag 2023-09-28 09:25:17 +08:00
hi-rustin
61648f583e Add test for unsupported silent flag 2023-09-22 10:50:23 +08:00
Jakub Beránek
5405cd3a8b
Print environment variables for cargo run in extra verbose mode 2023-08-15 13:45:42 +02:00
Weihang Lo
64a1f204f3
refactor: only when -C debuginfo > 0 will spilt-debuginfo be passed
It was unnecessary to pass `spilt-debuginfo` if there is no debuginfo.
Tests are touched here only for matching rustflags invocation stderr
in the original test suite.
2023-05-31 20:43:57 +01:00
Ed Page
6feea34f8a chore: Upgrade to clap v4.2
Tests in `master` are currently failing because its building with clap
v4.2 but the tests have snapshots from v4.1
2023-03-28 05:00:49 -05:00
Weihang Lo
c51c6bb6ac
chore: reflect to clap updates 2023-01-14 09:23:39 +00:00
Ed Page
96948f7a24 refactor(cli): Upgrade to clap v4 2022-09-28 13:32:14 -05:00
Scott Schafer
ab18bd40d5 refactor(testsuite): Replace [project] with [package] 2022-09-26 09:51:16 -06:00
hi-rustin
99b3564d0d Update old tests
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-08-19 10:56:29 +08:00
Josh Stone
ec1bdd20a2 Fix term.verbose without quiet, and vice versa
The match pattern only looked for `Some(false)`, missing `None`.
2022-02-26 14:17:00 -08:00
Weihang Lo
11c50416c2
Assert optional args with square brackets [arg...] 2022-01-27 19:28:51 +08:00
Ed Page
f17ecafc24 Upgrade to Clap 3
- One parser change found by `cargo_config::includes` is that clap 2
  would ignore any values after a `=` for flags.
  `cargo config --show-origin` is a flag but the test passed `--show-origin=yes` which
  happens to give the desired result for that test but is the same as
  `--show-origin=no` or `--show-origin=alien-invasion`.
- The parser now panics when accessing an undefined attribute but clap
  takes advantage of that for sharing code across commands that have
  different subsets of arguments defined.  I've extended clap so we can
  "look before you leap" and put the checks at the argument calls to
  start off with so its very clear what is tenuously shared.  This
  allows us to go in either direction in the future, either addressing
  how we are sharing between commands or by moving this down into the
  extension methods and pretending this clap feature doesn't exist
- On that topic, a test found clap-rs/clap#3263.  For now, there is a
  hack in clap.  Depending on how we fix that in clap for clap 4.0, we
  might need to re-address things in cargo.
- `value_of_os` now requires setting `allow_invalid_utf8`, otherwise it
  asserts.  To help catch this, I updated the argument definitions
  associated with lookups reported by:
  - `rg 'values?_os' src/`
  - `rg 'values?_of_os' src/`
- clap now reports `2` for usage errors, so we had to bypass clap's
  `exit` call to keep the same exit code.

BREAKING CHANGE: API now uses clap3
2022-01-05 19:54:54 -06:00
bors
a359ce1607 Auto merge of #10152 - steven-joruk:quiet-config, r=ehuss
Support `term.quiet` configuration

Fixes #10128

This follows the existing support for `--verbose` and `term.verbose`.

I've renamed the related tests to be a bit clearer now there are more cases, and the existing quiet tests now prove that they hide the cargo log.

I'm unsure whether I'm supposed to regenerate the documentation as part of this?
2021-12-14 18:40:22 +00:00
Steven Joruk
7ac6f53743 Code review fixes 2021-12-08 22:18:47 +00:00
Steven Joruk
ed9ec388fd Support term.quiet configuration
This matches how users can specify `--verbose` on the command line, or
`term.verbose` in the configuration.
2021-12-03 06:25:02 +00:00