Skip to content

Commit 383c708

Browse files
committed
Label milestone_2 test2 output
1 parent ca97175 commit 383c708

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

tests/stylus_tests/milestone_2.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,16 @@ fn milestone_2() {
3333
["test()(uint64,uint256,address,uint256,uint256,uint256,uint256)"],
3434
)
3535
.unwrap();
36-
println!("{}", label(&stdout));
36+
println!("{}", label_test_output(&stdout));
3737

3838
stdout = call(dir, &address, ["test2()(uint256,uint256)"]).unwrap();
39-
println!("{}", stdout);
39+
println!("{}", label_test2_output(&stdout));
4040

4141
stdout = send(dir, &address, ["test3()", "--value=1000000000000000000"]).unwrap();
4242
println!("{}", stdout);
4343
}
4444

45-
fn label(stdout: &str) -> String {
45+
fn label_test_output(stdout: &str) -> String {
4646
const LABELS: &[&str] = &[
4747
"gasleft",
4848
"basefee",
@@ -60,3 +60,14 @@ fn label(stdout: &str) -> String {
6060
.map(|(label, line)| format!("{label} = {line}\n"))
6161
.collect()
6262
}
63+
64+
fn label_test2_output(stdout: &str) -> String {
65+
const LABELS: &[&str] = &["sload", "tload"];
66+
let lines = stdout.lines().collect::<Vec<_>>();
67+
assert_eq!(LABELS.len(), lines.len());
68+
LABELS
69+
.iter()
70+
.zip(lines)
71+
.map(|(label, line)| format!("{label} = {line}\n"))
72+
.collect()
73+
}

0 commit comments

Comments
 (0)