Skip to content
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

Add integer to string formatting tests #138546

Merged
merged 2 commits into from
Apr 5, 2025

Conversation

GuillaumeGomez
Copy link
Member

As discussed in #136264, there doesn't seem to have tests to ensure that int to string conversion is performed correctly, only sporadic tests here and there. Now we have some basic tests. :)

r? @Mark-Simulacrum

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Mar 15, 2025
@GuillaumeGomez GuillaumeGomez force-pushed the integer-to-string-tests branch from 09c42c7 to 47b2f7f Compare March 15, 2025 22:08
@rust-log-analyzer

This comment has been minimized.

@GuillaumeGomez GuillaumeGomez force-pushed the integer-to-string-tests branch from 47b2f7f to b2b1ed2 Compare March 15, 2025 22:53
@rust-log-analyzer

This comment has been minimized.

@jieyouxu
Copy link
Member

jieyouxu commented Mar 16, 2025

FYI (very recent change) alloc tests are now a separate package, alloctests

EDIT: see #136642

@jieyouxu jieyouxu added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 16, 2025
@GuillaumeGomez GuillaumeGomez force-pushed the integer-to-string-tests branch from b2b1ed2 to bacd57a Compare March 16, 2025 13:45
@GuillaumeGomez
Copy link
Member Author

Wow, talk about bad luck. 😆

Thanks for the links @jieyouxu! Updated the PR to use alloctests instead.


fn assert_nb<Int: ToString + FromStr + Debug + Display + Eq>(value: Int) {
let s = value.to_string();
let s2 = format!("{}", value);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe worth doing something like format!("s: {}.") to avoid this losing coverage if we ever impl #76531, #52804, ... -- will make the assertions a bit more complicated, but seems plausibly worth it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, done!

@rust-log-analyzer

This comment has been minimized.

@GuillaumeGomez GuillaumeGomez force-pushed the integer-to-string-tests branch from 1cf1166 to 25900c2 Compare March 23, 2025 21:34
@GuillaumeGomez
Copy link
Member Author

Forgot to run x.py fmt. Fixed now.

@GuillaumeGomez
Copy link
Member Author

@rustbot review

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 31, 2025
@GuillaumeGomez
Copy link
Member Author

r? @Amanieu

@rustbot rustbot assigned Amanieu and unassigned Mark-Simulacrum Mar 31, 2025
@Amanieu
Copy link
Member

Amanieu commented Apr 3, 2025

@bors r+

@bors
Copy link
Collaborator

bors commented Apr 3, 2025

📌 Commit 25900c2 has been approved by Amanieu

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 3, 2025
Zalathar added a commit to Zalathar/rust that referenced this pull request Apr 4, 2025
…ests, r=Amanieu

Add integer to string formatting tests

As discussed in rust-lang#136264, there doesn't seem to have tests to ensure that int to string conversion is performed correctly, only sporadic tests here and there. Now we have some basic tests. :)

r? `@Mark-Simulacrum`
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 4, 2025
Rollup of 14 pull requests

Successful merges:

 - rust-lang#137869 (Demote i686-pc-windows-gnu to Tier 2)
 - rust-lang#137880 (Autodiff batching)
 - rust-lang#138546 (Add integer to string formatting tests)
 - rust-lang#138947 (Refactor Apple version handling in the compiler)
 - rust-lang#138950 (replace extra_filename with strict version hash in metrics file names)
 - rust-lang#139213 (Run coretests and alloctests with cg_clif in CI)
 - rust-lang#139274 (Rustdoc: typecheck settings.js)
 - rust-lang#139295 (Remove creation of duplicate `AnonPipe`)
 - rust-lang#139298 (Allow for missing invisible close delim when reparsing an expression.)
 - rust-lang#139313 (Deduplicate some `rustc_middle` function bodies by calling the `rustc_type_ir` equivalent)
 - rust-lang#139317 (compiletest: Encapsulate all of the code that touches libtest)
 - rust-lang#139322 (Add helper function for checking LLD usage to `run-make-support`)
 - rust-lang#139335 (Pass correct param-env to `error_implies`)
 - rust-lang#139342 (Add a mailmap entry for myself)

Failed merges:

 - rust-lang#138949 (Rename `is_like_osx` to `is_like_darwin`)

r? `@ghost`
`@rustbot` modify labels: rollup
Zalathar added a commit to Zalathar/rust that referenced this pull request Apr 4, 2025
…ests, r=Amanieu

Add integer to string formatting tests

As discussed in rust-lang#136264, there doesn't seem to have tests to ensure that int to string conversion is performed correctly, only sporadic tests here and there. Now we have some basic tests. :)

r? ``@Mark-Simulacrum``
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Apr 4, 2025
…ests, r=Amanieu

Add integer to string formatting tests

As discussed in rust-lang#136264, there doesn't seem to have tests to ensure that int to string conversion is performed correctly, only sporadic tests here and there. Now we have some basic tests. :)

r? ```@Mark-Simulacrum```
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 4, 2025
…iaskrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#138546 (Add integer to string formatting tests)
 - rust-lang#138950 (replace extra_filename with strict version hash in metrics file names)
 - rust-lang#139028 (Make target maintainers more easily pingable)
 - rust-lang#139274 (Rustdoc: typecheck settings.js)
 - rust-lang#139275 (Update the minimum external LLVM to 19)
 - rust-lang#139328 (Fix 2024 edition doctest panic output)

Failed merges:

 - rust-lang#138947 (Refactor Apple version handling in the compiler)

r? `@ghost`
`@rustbot` modify labels: rollup
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Apr 4, 2025
…ests, r=Amanieu

Add integer to string formatting tests

As discussed in rust-lang#136264, there doesn't seem to have tests to ensure that int to string conversion is performed correctly, only sporadic tests here and there. Now we have some basic tests. :)

r? ````@Mark-Simulacrum````
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 4, 2025
…iaskrgr

Rollup of 5 pull requests

Successful merges:

 - rust-lang#138546 (Add integer to string formatting tests)
 - rust-lang#138950 (replace extra_filename with strict version hash in metrics file names)
 - rust-lang#139028 (Make target maintainers more easily pingable)
 - rust-lang#139274 (Rustdoc: typecheck settings.js)
 - rust-lang#139328 (Fix 2024 edition doctest panic output)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 5, 2025
Rollup of 11 pull requests

Successful merges:

 - rust-lang#136457 (Expose algebraic floating point intrinsics)
 - rust-lang#137880 (Autodiff batching)
 - rust-lang#137897 (fix pthread-based tls on apple targets)
 - rust-lang#138024 (Allow optimizing out `panic_bounds_check` in Unicode checks.)
 - rust-lang#138546 (Add integer to string formatting tests)
 - rust-lang#138826 (StableMIR: Add `associated_items`.)
 - rust-lang#138950 (replace extra_filename with strict version hash in metrics file names)
 - rust-lang#139274 (Rustdoc: typecheck settings.js)
 - rust-lang#139285 (use lower case to match other error messages)
 - rust-lang#139341 (Apply `Recovery::Forbidden` when reparsing pasted macro fragments.)
 - rust-lang#139389 (make `Arguments::as_statically_known_str` doc(hidden))

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 338b878 into rust-lang:master Apr 5, 2025
6 checks passed
@rustbot rustbot added this to the 1.88.0 milestone Apr 5, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Apr 5, 2025
Rollup merge of rust-lang#138546 - GuillaumeGomez:integer-to-string-tests, r=Amanieu

Add integer to string formatting tests

As discussed in rust-lang#136264, there doesn't seem to have tests to ensure that int to string conversion is performed correctly, only sporadic tests here and there. Now we have some basic tests. :)

r? `````@Mark-Simulacrum`````
@GuillaumeGomez GuillaumeGomez deleted the integer-to-string-tests branch April 5, 2025 18:08
github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this pull request Apr 10, 2025
…ests, r=Amanieu

Add integer to string formatting tests

As discussed in rust-lang#136264, there doesn't seem to have tests to ensure that int to string conversion is performed correctly, only sporadic tests here and there. Now we have some basic tests. :)

r? `````@Mark-Simulacrum`````
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants