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.
test: migrate implicit_features to snapbox
### What does this PR try to resolve?
Part of https://github.com/rust-lang/cargo/issues/14039.
Migrate following to snapbox:
- `tests/testsuite/implicit_features.rs`
test: migrate check_cfg to snapbox
### What does this PR try to resolve?
Part of https://github.com/rust-lang/cargo/issues/14039.
Migrate following to snapbox:
- `tests/testsuite/check_cfg.rs`
---
This commit allow deprecation for most of the tests currently in this file. This is because the tests either use `does_not_contain` or perform multiple `contains` assertion for single tool with macro `x!`.
Here are some potential options to further eliminate the deprecation:
1. Remove the `x!` macro and replace the it with `str![]` for both Windows and non-Windows platforms.
2. Modify the `x!` macro to only generate the `--check-cfg` part for different platforms and manually compose it with `format!`.
I was changing the "duplicate package" warning to be like:
```
[WARNING] skipping duplicate package `a2 v0.5.0 ([ROOT]/foo/b/../a)`:
[ROOT]/foo/b/../a/a2/Cargo.toml
in favor of [ROOT]/foo/a/a2/Cargo.toml
```
and it showed that we were considering two paths to the same package to
be duplicates.
This suppresses that warning.
test: migrate member_errors, multitarget and new to snapbox
### What does this PR try to resolve?
Part of https://github.com/rust-lang/cargo/issues/14039.
Migrate following to snapbox:
- `tests/testsuite/member_errors.rs`
- `tests/testsuite/multitarget.rs`
- `tests/testsuite/new.rs`
test: migrate generate_lockfile and glob_targets to snapbox
### What does this PR try to resolve?
Part of https://github.com/rust-lang/cargo/issues/14039.
Migrate following to snapbox:
- `tests/testsuite/generate_lockfile.rs`
- `tests/testsuite/glob_targets.rs`
test: migrate metabuild, metadata and net_config to snapbox
### What does this PR try to resolve?
Part of https://github.com/rust-lang/cargo/issues/14039.
Migrate following to snapbox:
- `tests/testsuite/metabuild.rs`
- `tests/testsuite/metadata.rs`
- `tests/testsuite/net_config.rs`
test: migrate serveral files to snapbox
### What does this PR try to resolve?
Part of https://github.com/rust-lang/cargo/issues/14039.
Migrate following to snapbox:
- `tests/testsuite/read_manifest.rs`
- `tests/testsuite/rustdoc_extern_html.rs`
- `tests/testsuite/tool_paths.rs`
- `tests/testsuite/warn_on_failure.rs`
Allow enabling `config-include` feature in config
### What does this PR try to resolve?
Prior to this change, it is not possible to enable the unstable `config-include` flag from within a config file itself. This is due to the fact that, while cargo does reload configuration files if this flag is set, it does not parse the top-level configuration file's unstable flags before checking whether this flag is present.
This commit forces cargo to load unstable features before this check, and if the flag is present, re-loads configuration files with `config-include` enabled.
Addresses https://github.com/rust-lang/cargo/issues/7723#issuecomment-2206667822.
### How should we test and review this PR?
This PR adds a testcase for this behavior to cargo's testsuite. In general, it can be replicated with a config similar to that in the testcase, or as illustrated in https://github.com/rust-lang/cargo/issues/7723#issuecomment-2206667822.
### Additional information
~I'm not sure whether this is the right(TM) fix, or whether the second `self.load_unstable_flags_from_config()?;` at the bottom of `configure()` would still be required. I have a feeling it might not be, as `reload_rooted_at` also calls out to `load_unstable_flags_from_config`, to collect flags from any newly included configs. If that is not called, no other file was loaded, and thus there should not be a need to re-load unstable flags.~
Resolved: https://github.com/rust-lang/cargo/pull/14196#discussion_r1667205897
Prior to this change, it is not possible to enable the unstable
`config-include` flag from within a config file itself. This is due to
the fact that, while cargo does reload configuration files if this
flag is set, it does not parse the top-level configuration file's
unstable flags before checking whether this flag is present.
This commit forces cargo to load unstable features before this check,
and if the flag is present, re-loads configuration files with
`config-include` enabled.
This is partial revert of #14185
(27062476a86e864479ef6bde1828c624b643de4b)
Although the changes made in that commit are valid, for the same reason
mentioned in the comment https://github.com/rust-lang/cargo/pull/14181#discussion_r1667089718,
"People are unlikely to see these comments when updating snapshots".
Therefore, it would be better to revert these parts.