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

Enable volatile values in testing #5025

Open
Rumata888 opened this issue May 13, 2024 · 0 comments
Open

Enable volatile values in testing #5025

Rumata888 opened this issue May 13, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@Rumata888
Copy link
Collaborator

Problem

Currently the following test fails:

#[test(should_fail)]
fn test_u8_underflow(){
let a: u8 = 47;
let b: u8 = 48;
let _ = a - b;
}

Because the underflow constraint is optimised out. So we have to use println to make the result value used instead.

Happy Case

Create a function like volatile to make the value used without printing

Project Impact

Nice-to-have

Impact Context

When we're writing tests for stdlib this is going to be an isse

Workaround

Yes

Workaround Description

Use println

Additional Context

No response

Would you like to submit a PR for this Issue?

None

Support Needs

No response

@Rumata888 Rumata888 added the enhancement New feature or request label May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: 📋 Backlog
Development

No branches or pull requests

1 participant