Skip to content

Commit

Permalink
test: use a regex to match build sizes output (#511)
Browse files Browse the repository at this point in the history
  • Loading branch information
elfedy authored Aug 9, 2024
1 parent 624cd93 commit 5a8f447
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion crates/forge/tests/cli/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use foundry_common::fs::read_json_file;
use foundry_config::Config;
use foundry_test_utils::forgetest;
use globset::Glob;
use regex::Regex;
use std::{collections::BTreeMap, path::PathBuf};

// tests that json is printed when --json is passed
Expand Down Expand Up @@ -55,7 +56,9 @@ forgetest_init!(build_sizes_no_forge_std, |prj, cmd| {
forgetest_init!(test_zk_build_sizes, |prj, cmd| {
cmd.args(["build", "--sizes", "--zksync", "--evm-version", "shanghai"]);
let stdout = cmd.stdout_lossy();
assert!(stdout.contains("| Counter | 800 | 450,199 |"), "\n{stdout}");
let pattern = Regex::new(r"\|\s*Counter\s*\|\s*800\s*\|\s*450,199\s*\|").unwrap();

assert!(pattern.is_match(&stdout), "Unexpected size output:\n{stdout}");
});

// tests that skip key in config can be used to skip non-compilable contract
Expand Down

0 comments on commit 5a8f447

Please sign in to comment.