67 Commits

Author SHA1 Message Date
Dawid Ciężarkiewicz
c712f08862 Do not add home bin path to PATH if it's already there
This is to allow users to control the order via PATH if they so desire.

Fix #11020
2022-09-08 09:37:41 -07:00
akabinds
222d90b78e test checking full stderr output, with new message, resulting from a "did you mean" 2022-08-03 11:38:41 -05:00
akabinds
8f5f2ed2a2 implement test checking if stderr, after using +toolchain, contains message stating that the directive is not handled by Cargo 2022-08-03 11:07:17 -05:00
akabinds
5f3ded124f stop mixing of newlines and \n in tests 2022-08-02 19:43:16 -05:00
akabinds
42df87409b fix formatting 2022-08-02 18:27:36 -05:00
akabinds
b2f44de83d implemented requested changes; tests pass 2022-08-02 18:23:55 -05:00
akabinds
b55e8d47a9 implemented requested changes; fixed one failing test (need to fix other) 2022-08-02 13:01:32 -05:00
cuishuang
6f13c466d2 fix some typos
Signed-off-by: cuishuang <imcusg@gmail.com>
2022-05-08 01:07:28 +08:00
Midas Lambrichts
42528799e2 Make levenshtein distance case insensitive.
When typing in a single character shortcut as a capital, it always
returns `b` as the suggestion as every one-letter abbreviation
is a lev distance 1 away from the capitalized one.
By making the levenshtein distance case insensitive, the case-mismatched
one-letter abbriviation (e.g. `C` to `c`) will be suggested, rather
than `b`
2021-12-21 12:56:28 +01:00
Eric Huss
910569aac3 Explicitly mark aliases in cargo list. 2021-12-06 14:02:21 -08:00
Nipunn Koorapati
1edd8630c9 Show desc of well known subcommands (fmt, clippy) in cargo --list 2021-08-27 12:28:30 -07:00
Nipunn Koorapati
5a56cf2e5b Refactor echo cargo subcommand test helper into cargo-test-support 2021-08-14 22:37:54 -07:00
Nipunn Koorapati
0ab79d7aaf Deduplicate entries in cargo --list
Fixes #6088
2021-08-09 10:29:21 -07:00
Dustin J. Mitchell
1c5e68b4f3 Include aliases with other commands
The principal result is that they are now automatically included in the
`cargo --list` output.  Fixes #8486.
2021-08-07 13:52:12 +00:00
Nipunn Koorapati
dde290e6ff Refactor fake_file() away from cargo_command tests
There are already similar preexisting test helpers which
also work on windows. Port over the executable-creation
helper into the file() helper and things appear to pass.
2021-08-05 19:09:58 -07:00
Eric Huss
aea5ca3ca0 Remove the double-backslash escape for matching.
Using `with_json` is safer since it knows what JSON escaping is.
2021-06-16 09:44:29 -07:00
Jade
b09988649a Restore the tests that could be reused 2021-03-22 13:39:18 -07:00
lf-
47347de87e Delete redundant broken tests 2021-03-22 13:39:18 -07:00
bjorn3
f5a3d55983 Fix warnings of the new non_fmt_panic lint 2021-02-06 19:10:42 +01:00
Eric Huss
6f8c7d5a87 Normalize raw string indentation. 2020-09-26 17:59:58 -07:00
Eric Huss
9138d65e4c Create a dedicated module for help tests. 2020-08-03 12:17:58 -07:00
CPerezz
7b16c7c130 Add test for listing builtin aliases
Added a test that checks that the aliases that currently
are builtin with cargo are indeed being printed with the rest
of the commands when `cargo --list` is called.

Closes #8486
2020-07-24 23:40:49 +02:00
Eric Huss
7274307af4 Ignore broken console output in some situations. 2020-05-13 16:22:24 -07:00
Eric Huss
4ae79d2ffd Use fs helpers instead of File functions. 2020-04-17 07:56:16 -07:00
Matthias Krüger
1d912002e9 fix most remaining clippy findings (mostly redundant imports) 2020-02-21 12:15:16 +01:00
Takayuki Nakata
ad2969f084 Update the output of cargo -Z help
`--registry` flag is already stabilized at 737382d7e.
2019-12-18 10:28:48 +09:00
Eric Huss
83571aee56 Minor testsuite organization. 2019-11-24 18:42:45 -08:00
Zach Lute
ff3e880c17 Added aliases to subcommand typo suggestions.
Fixes #7278.

Also adds tests for alias suggestions.
2019-10-05 08:44:26 -07:00
Alex Crichton
ebd10526f3 Run rustfmt 2019-09-16 12:00:12 -07:00
Alex Crichton
9115b2c326 Extract support directory to its own crate
Extract out all our test support code to its own standalone crate so it
can be shared between multiple test suites if necessary.
2019-09-16 11:47:09 -07:00
Jethro Beekman
0e0d968825 Update #[test] attribute on all tests in the testsuite
sed -i 's/^#\[test\]/#[cargo_test]/' $(rg -l '^#\[test\]')

Manual fixes:
* proc_macro::proc_macro_doctest
2019-06-07 12:41:26 -07:00
Alexander Regueiro
f7c91ba622
Various cosmetic improvements. 2019-02-20 10:58:27 +00:00
Alex Crichton
fecb724643 Format with cargo fmt 2018-12-08 03:19:47 -08:00
Dale Wijnand
6d1d3a6840
Fix 2018 edition idioms 2018-12-06 20:26:07 +01:00
Dale Wijnand
04ddd4d0fc
Upgrade to Rust 2018 2018-12-06 20:18:35 +01:00
Dale Wijnand
092f7baea3
Fix cargo_command::cargo_subcommand_args test 2018-11-18 14:44:16 +00:00
Dale Wijnand
49f73b9c4e
Simplify cargo_command::cargo_subcommand_args test 2018-11-18 13:38:33 +00:00
Zach Lute
89f43938fe Print file paths instead of file:// URLs.
This change ensures cargo will output file paths in the expected format
(C:\foo\... on Windows, /foo/... elsewhere). Previously it would output
file:// URLs instead.

To support this change, additional changes were made to the test suite
string processing such that [ROOT] is now replaced with the appropriate
file path root for the platform.

The CWD template was also updated to use [CWD] like other replacement
templates and to do the replacement on the expected value rather than
the actual value to avoid replacing things we don't expect with CWD.
2018-09-07 19:42:59 -07:00
Dale Wijnand
d5fc8dc3a7
Introduce the CWD macro in test output asserting
Avoids dealing with things like CWD changing.
2018-08-30 11:05:29 +02:00
Dale Wijnand
570fe8927d
Remove hamcrest existing_file() 2018-08-29 10:26:12 +02:00
Dale Wijnand
63b34b6498
Revert back to some .exec_with_output() usage
Avoids difference in indentations across different PATHs.
2018-08-29 02:04:32 +02:00
Dale Wijnand
a173fc0abe
Replace .exec_with_output() usage with .with_stdout_contains 2018-08-29 00:45:19 +02:00
Dale Wijnand
85984a8700
Migrate from tests fom assert_that/execs to .run() 2018-08-28 15:08:12 +02:00
Dale Wijnand
16aeb0cd4f
Default test support's Execs to exit code 0 2018-08-03 07:44:42 +01:00
Dale Wijnand
8940d30668
Make cargo_process take a string it splits on whitespace 2018-08-02 18:00:02 +01:00
Dale Wijnand
09cd53832c
Adapt --list output in find_closest_biuld_to_build test 2018-07-26 21:41:43 +01:00
Dale Wijnand
a838f8fa9c
Fix read-manifest summary printing under cargo --list 2018-07-26 12:09:04 +01:00
Dale Wijnand
af2c355585
Show the command summary when running cargo --list 2018-07-26 12:08:39 +01:00
Dale Wijnand
ab19c48358
Dedup a bunch more manifest 2018-07-25 00:43:30 +01:00
Dale Wijnand
43b42d6f4c
Reorganise the testsuite crate module hierarchy
* Collapse the nested cargotest::support module into the cargotest
  module (merge the mod.rs's)
* Rename the cargotest module to support
* Nest the top-level hamcrest module into support
2018-07-22 08:46:44 +01:00