-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Use RustOptimize to set optimize #112756
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
Use RustOptimize to set optimize #112756
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -178,3 +178,22 @@ fn profile_user_dist() { | |
} | ||
Config::parse_inner(&["check".to_owned()], get_toml); | ||
} | ||
|
||
#[test] | ||
fn rust_optimize() { | ||
let parse = |s| Config::parse_inner(&["check".to_owned()], |&_| toml::from_str(s).unwrap()); | ||
|
||
assert_eq!(parse("").rust_optimize.is_release(), true); | ||
assert_eq!(parse("rust.optimize = false").rust_optimize.is_release(), false); | ||
assert_eq!(parse("rust.optimize = true").rust_optimize.is_release(), true); | ||
assert_eq!(parse("rust.optimize = \"1\"").rust_optimize.get_opt_level(), Some("1".to_string())); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i'd prefer to require this to be an int instead of a string, so There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about the "s" and "z"? Do you mean we need to use an IntOrString here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, exactly There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll fix it later. |
||
assert_eq!(parse("rust.optimize = \"s\"").rust_optimize.get_opt_level(), Some("s".to_string())); | ||
} | ||
|
||
#[test] | ||
#[should_panic] | ||
fn invalid_rust_optimize() { | ||
Config::parse_inner(&["check".to_owned()], |&_| { | ||
toml::from_str("rust.optimize = \"a\"").unwrap() | ||
}); | ||
0xPoe marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} |
Uh oh!
There was an error while loading. Please reload this page.