Commit graph

33 commits

Author SHA1 Message Date
Ed Page
675224b3a0 test(config): Shift to config.toml 2024-01-26 13:40:46 -06:00
Ed Page
5cac7aa8c6 fix(toml): Remove redundant error messages 2023-08-24 16:19:48 -05:00
Ed Page
6007f05a85 chore: Update to toml v0.6, toml_edit v0.18
`toml` replaces `toml_edit::easy`, using `toml_edit` as its parser.
2023-01-19 15:26:28 -06:00
Basile Henry
3ff6d9e698 Add built-in alias shadowing not warning test 2022-10-13 22:22:52 +01:00
Weihang Lo
ef7a4ef062
Dont swallow errors when checking existence of a config key 2022-09-22 10:52:39 +01:00
Weihang Lo
2c6647df80
test(alias): with malformed config no proper error emitted
This demonstrate the old behaviour that no proper error is emitted if
there is a parse error during configuration parsing.
2022-09-22 10:46:32 +01:00
Ed Page
8f8a79a5a4 fix(cli): Error trailing args rather than ignore
This warning has been in for a sufficient time, requires a hack from
clap to avoid all argument ID validation, and allows users to run the
wrong command (imagine `cargo -- publish --dry-run`).

See also https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/Cargo.20ignoring.20arguments.20with.20.60cargo.20--.20check.20--ignored.60
2022-09-20 16:54:01 -05:00
Basile Henry
0b4e2ca330 Add test for alias shadowing external subcommand
This is currently still permitted, so we only test that the warning is properly issued
2021-11-17 09:23:06 +01:00
Basile Henry
cba8503e3a Add details in warning for alias shadowing external subcommands 2021-11-17 09:22:08 +01:00
Basile Henry
3a5bb75467
Update tests/testsuite/cargo_alias_config.rs 2021-11-14 20:22:13 +00:00
Basile Henry
2ead2d9e3d
Update tests/testsuite/cargo_alias_config.rs 2021-11-14 20:22:05 +00:00
Basile Henry
9f768bbcd8 Update test for warning for alias shadowing an external subcommand 2021-11-14 20:38:40 +01:00
Nipunn Koorapati
28e1289eb1 Teach cargo to failfast on recursive/corecursive aliases
Eg.
[alias]
test-1 = test-2
test-2 = test-3
test-3 = test-1

Previously it would stack overflow

It pulls out non controversial bits from from #9768
2021-08-15 11:27:03 -07:00
Alik Aslanyan
e5d10f973d
Implement warning for ignored trailing arguments
in case built-in `cargo` command was invoked with `--`
2021-06-09 18:50:51 +04:00
Eric Huss
6f8c7d5a87 Normalize raw string indentation. 2020-09-26 17:59:58 -07:00
Eric Huss
0279e8e63a Fix using global options before an alias. 2020-01-31 13:56:06 -08:00
Eric Huss
83571aee56 Minor testsuite organization. 2019-11-24 18:42:45 -08: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
Alex Crichton
fecb724643 Format with cargo fmt 2018-12-08 03:19:47 -08:00
Dale Wijnand
04ddd4d0fc
Upgrade to Rust 2018 2018-12-06 20:18:35 +01:00
Eric Huss
e8f37daeff Fix built-in aliases taking arguments. 2018-12-05 09:29:10 -08:00
Hidehito Yabuuchi
ea1f525c02 Allow user aliases to override built-in aliases 2018-11-18 18:08:28 +09:00
Dale Wijnand
85984a8700
Migrate from tests fom assert_that/execs to .run() 2018-08-28 15:08:12 +02:00
Dale Wijnand
af4f1392f7
Collapse ProcessBuilder::arg calls in tests
.. with mutliple calls of:

    fastmod --accept-all '\.cargo\("([^"]+)"\)\.arg\("([^"]+)"\)' '.cargo("${1} ${2}")' tests/testsuite/

until no changes are left.
2018-08-18 15:05:45 +01:00
Dale Wijnand
16aeb0cd4f
Default test support's Execs to exit code 0 2018-08-03 07:44:42 +01:00
Dale Wijnand
ca7d9ee292
Declare one-line files on one line, in test projects 2018-07-25 09:58:50 +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
Dale Wijnand
7fe2fbc8a3
Remove the argument from the project test support function
By rewriting the tests, with rerast (https://github.com/google/rerast),
to use the newly introduced "at" method.

First I added the following temporary function to cargotest::support:

    pub fn project_foo() -> ProjectBuilder {
        project("foo")
    }

Then I defined the following rewrite.rs:

    use cargotest::support::{ project, project_foo };

    fn rule1(a: &'static str) {
        replace!(project("foo") => project_foo());
        replace!(project(a) => project_foo().at(a));
    }

Then I ran rerast:

    cargo +nightly rerast --rules_file=rewrite.rs --force --targets tests --file tests/testsuite/main.rs

Finally I searched and replaced the references to project_foo with
argument-less project (a little awkardly on macOS with a git clean).

    find tests -type f -exec sed -i -e 's/project_foo/project/g' {} +
    git clean -d tests
2018-07-20 13:31:50 +01:00
Aleksey Kladov
ecd1e5df0f Tweak error messages
By convention, all errors should start with a lowercase letter
2018-05-03 18:31:23 +03:00
Aleksey Kladov
d49910fd21 Make alias handling more straightforward
Previously, `execute_subcommand` was called recursively, and each call
would `.configure` the `config` again. It worked, but seemed rather
fragile.

This commit handles aliases more explicitly, ensures that `.configure`
is called once and, as a bonus, adds a warning for when an alias is
shadowed by the built in.
2018-05-03 18:29:51 +03:00
Alex Crichton
1e6828485e cargo fmt 2018-03-14 17:48:23 -07:00
André Rocha
c2ff988c9f Reorganize integration tests as one crate with many modules. Issue #4867. 2018-02-21 13:33:51 -05:00
Renamed from tests/cargo_alias_config.rs (Browse further)