Skip to content

Commit 5685012

Browse files
apollo_compile_to_casm: fix regex in test_max_memory_usage (#10637)
1 parent 0ce8b51 commit 5685012

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/apollo_compile_to_casm/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ apollo_compilation_utils = { workspace = true, features = ["testing"] }
3232
apollo_infra_utils.workspace = true
3333
assert_matches.workspace = true
3434
mempool_test_utils.workspace = true
35+
regex.workspace = true
3536

3637
[build-dependencies]
3738
apollo_compilation_utils.workspace = true

crates/apollo_compile_to_casm/src/compile_test.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use cairo_lang_starknet_classes::allowed_libfuncs::{
1616
use cairo_lang_starknet_classes::contract_class::ContractClass as CairoLangContractClass;
1717
use mempool_test_utils::{FAULTY_ACCOUNT_CLASS_FILE, TEST_FILES_FOLDER};
1818
use pretty_assertions::assert_eq;
19+
use regex::Regex;
1920
use starknet_api::contract_class::{ContractClass, SierraVersion};
2021
use starknet_api::state::SierraContractClass;
2122

@@ -161,8 +162,9 @@ fn test_max_memory_usage() {
161162
audited_libfuncs_only: false,
162163
});
163164
let compilation_result = compiler.compile(contract_class);
165+
let expected_error_pattern = Regex::new(r"memory allocation .*fail").unwrap();
164166
assert_matches!(compilation_result, Err(CompilationUtilError::CompilationError(string))
165-
if string.contains("memory allocation failure")
167+
if expected_error_pattern.is_match(&string)
166168
);
167169
}
168170

0 commit comments

Comments
 (0)