Skip to content

ctest: Small adjustments to existing tests #4554

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 17, 2025

Conversation

tgross35
Copy link
Contributor

See each commit message for more details.

@rustbot rustbot added ctest Issues relating to the ctest crate S-waiting-on-review A-CI Area: CI-related items labels Jul 17, 2025
@tgross35
Copy link
Contributor Author

Fyi @mbyx

tgross35 added 4 commits July 16, 2025 20:23
`let_chains` is a feature only available in edition 2024 and stabilized
in 1.88, so this allows us to make use of them.

Needed fixes include substituting `gen` to `gen_` since that is now a
reserved keyword, and making `env::set_var` unsafe (this needs to be
fixed). There are also automatic changes for format edition 2024 (e.g.
import reordering).

This needs a small CI hack where we temporarily remove the `ctest-next`
crate from the workspace because old Cargo doesn't recognize "2024" as a
valid edition.
When a type has restricted visiblity, `pub` acts the same as
`pub(crate)`. Simplify to `pub` which is a bit cleaner.
Give a slightly better structure for our eyes to follow. Unfortunately
we can't do anything for C files.

This affects whitespace output in a way that isn't straightforward to
resolve with `+`/`-`/`~` Askama directives, so also ensure that template
output has a single trailing newline.
Currently nothing is added if a constant is a pointer but not a
`c_char`. Resolve this by reducing to a single branch.
@tgross35 tgross35 force-pushed the ctest-tweaks branch 4 times, most recently from 0193cad to 364a35d Compare July 17, 2025 00:51
tgross35 added 2 commits July 16, 2025 20:54
Apply the following changes:

* Separate `id` (a valid identifier) from `rust_const` (potentially an
  invalid indentifier with `::`) since for the future we can't assume we
  will always have top-level items. Rename a few other fields to be
  consistent.
* Change the `CStr` tests to be single-indirection, which is possible
  because we know the type.
* Split up some `unsafe` blocks and add safety comments.
* Rename test functions to start with `ctest_` rather than `__`.
* Rename `TestCstr` to `TestCStr` (casing).
The types of templates are statically known, as is the error type. We
can give this a strong typing rather than using strings.
@tgross35 tgross35 enabled auto-merge July 17, 2025 00:59
@tgross35 tgross35 added this pull request to the merge queue Jul 17, 2025
Merged via the queue into rust-lang:main with commit a3b2323 Jul 17, 2025
48 of 52 checks passed
@tgross35 tgross35 deleted the ctest-tweaks branch July 17, 2025 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-CI Area: CI-related items ctest Issues relating to the ctest crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants