Skip to content
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

tests: add check_output test helper #1458

Merged
merged 8 commits into from
Aug 22, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
review
  • Loading branch information
bartlomieju committed Aug 21, 2021
commit bda306a556067cab9917c120a745154053f15b17
9 changes: 6 additions & 3 deletions boa/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ pub(crate) enum TestAction {
pub(crate) fn check_output(actions: &[TestAction]) {
let mut context = Context::new();

for (i, action) in actions.iter().enumerate() {
let mut i = 1;
for action in actions {
match action {
TestAction::Execute(src) => {
forward(&mut context, src);
Expand All @@ -185,17 +186,19 @@ pub(crate) fn check_output(actions: &[TestAction]) {
&forward(&mut context, case),
expected,
"Test case {} ('{}')",
i + 1,
i,
case
);
i += 1;
}
TestAction::TestStartsWith(case, expected) => {
assert!(
&forward(&mut context, case).starts_with(expected),
"Test case {} ('{}')",
i + 1,
i,
case
);
i += 1;
}
}
}
Expand Down