47 Commits

Author SHA1 Message Date
Ross Sullivan
92d9a94d02
chore: Migrated testsuite to testsuite::prelude 2025-06-25 22:37:24 +09:00
Urgau
9563738dff Add support for boolean literals in target cfgs 2025-04-22 19:23:03 +02:00
Urgau
9a7a8cfb3b Add tests in preparation of boolean literal support in cfgs 2025-04-22 19:22:38 +02:00
Urgau
e2028d4bc2 Adjust future-incompatibility cfg keyword with raw-idents in cfgs 2024-11-25 22:01:44 +01:00
Urgau
9450706a03 Add support for raw-idents in cfgs 2024-11-25 22:01:44 +01:00
Urgau
3c3bfb0310 Add preliminary test for raw-idents in cfgs 2024-11-25 21:51:19 +01:00
Urgau
4946828211 Add future-incompatibility warning against some keyword-as-ident 2024-11-25 21:51:19 +01:00
Urgau
ac10b55e72 Add preliminary test for keywords in cfgs 2024-11-25 21:51:19 +01:00
Ed Page
878caf7447 docs: Surround identifiers in backticks
This was mostly done by clippy via `clippy::doc_markdown`.
I then reviewed it to fix words that shouldn't have it or where `--fix`
put the backtick in the wrong location.
2024-11-15 09:33:23 -06:00
Ed Page
ded3f004a4 fix(resolve): Generalize term describing updates
`latest` was easy.  `latest compatible` was ok.  But how do I talk about
"latest compatible with your MSRV".  That gets messy.
2024-08-30 09:26:56 -05: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
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
Weihang Lo
2b27914659
test: relax redaction for sysroot
sysroot is different when bootstrapping rustc

```
---- expected: tests/testsuite/cfg.rs:444:27
++++ actual:   stderr
   1    1 | [ERROR] output of --print=split-debuginfo missing when learning about target-specific information from rustc
   2    2 | command was: `[ROOT]/compiler/target/debug/compiler[..]--crate-type [..]`
   3    3 |
   4    4 | --- stdout
   5    5 | ___[EXE]
   6    6 | lib___.rlib
   7    7 | [..]___.[..]
   8    8 | [..]___.[..]
   9    9 | [..]___.[..]
  10   10 | [..]___.[..]
  11      - [..]rust[..]
       11 + /checkout/obj/build/[HOST_TARGET]/stage2
  12   12 |
```

https://github.com/rust-lang-ci/rust/actions/runs/9814397548/job/27101968836#step:25:10913
2024-07-06 09:40:29 -04:00
eth3lbert
de159b09f7
test: migrate cfg to snapbox 2024-07-04 07:52:27 +08: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
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
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
e7e8d8748a fix(compiler): Clarify we're showing a profile name 2024-02-08 14:01:39 -06:00
Scott Schafer
3845fc9b4d chore: update cfg tests to use check 2023-02-20 12:20:26 -06:00
Weihang Lo
036ed3a2dd
test(cfg): parse rustc --print=split-debuginfo 2023-01-27 02:45:04 +00:00
Eric Huss
8ce2a1bef3 Fix issue with filtering exclusive target dependencies. 2021-03-11 11:41:00 -08:00
Eric Huss
6f8c7d5a87 Normalize raw string indentation. 2020-09-26 17:59:58 -07:00
Eric Huss
83571aee56 Minor testsuite organization. 2019-11-24 18:42:45 -08:00
Eric Huss
57c96c194a Extract Platform to a separate crate. 2019-09-17 14:55:22 -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
Eric Huss
38983ce2e3 Better error messages when rustc discovery parsing fails. 2019-08-11 21:24:38 -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
Alex Crichton
e2637b6599 Review comments! 2018-09-18 11:33:18 -07:00
Dale Wijnand
41aa6fbab4
Update tests to new Updating msg format 2018-09-08 10:23:57 +01: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
bors
135ef53e09 Auto merge of #5852 - dwijnand:exit-code-0, r=alexcrichton
Default test support's Execs to exit code 0

Refs #5742
2018-08-03 15:42:54 +00:00
Dale Wijnand
16aeb0cd4f
Default test support's Execs to exit code 0 2018-08-03 07:44:42 +01:00
Marat Safin
b686606362 check target env in test when use targets 2018-08-03 08:31:33 +03:00
Dale Wijnand
ca7d9ee292
Declare one-line files on one line, in test projects 2018-07-25 09:58:50 +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
Dale Wijnand
f8c9928cc1
Rework some test projects to use the "foo" default
Generally that means either switching "foo" and "bar" around (reversing
the arrow), or it means push "foo" to "bar" (and sometimes "bar" to
"baz", etc..) to free up "foo".

For trivia that leaves 80/1222 outliers, therefore 93.4% of test
project use the default. :)
2018-07-21 19:40:45 +01:00
Dale Wijnand
6da2ada26d
Migrate trailing calls to project with an argument
.. in docs, commented code & tests targetting non-macos.
2018-07-20 15:25:51 +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
f7fa1f2ac5 Don't try to use the same info if target == host
The info might be different due to RUSTFLAGS, which, in general,
are applied only to target.
2018-04-18 18:00:21 +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