Skip to content

Commit

Permalink
Change default value from u32::max to none in order to support older …
Browse files Browse the repository at this point in the history
…versions of snforge
  • Loading branch information
Arcticae committed Jan 17, 2024
1 parent f44a480 commit b5133cd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,22 @@ pub fn forge_try_extract_test_config(

let result = maybe_test_config.map(
|TestConfig {
available_gas,
mut available_gas,
expectation,
ignored,
}| SingleTestConfig {
available_gas,
expected_result: expectation.into(),
ignored,
fork_config,
fuzzer_config,
}| {
// Older versions will crash if the default is passed through
if available_gas.is_some_and(|gas_amt| gas_amt == u32::MAX as usize){
available_gas = None
}

SingleTestConfig {
available_gas,
expected_result: expectation.into(),
ignored,
fork_config,
fuzzer_config,
}
},
);
Ok(result)
Expand Down
2 changes: 1 addition & 1 deletion extensions/scarb-snforge-test-collector/tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ fn forge_test_locations() {

assert_eq!(
&json[0]["test_cases"][0]["available_gas"],
&Value::Number(Number::from(u32::MAX))
&Value::Null
);
assert_eq!(&json[0]["test_cases"][0]["expected_result"], "Success");
assert_eq!(&json[0]["test_cases"][0]["fork_config"], &Value::Null);
Expand Down

0 comments on commit b5133cd

Please sign in to comment.