Skip to content

Commit

Permalink
Refactored tests
Browse files Browse the repository at this point in the history
  • Loading branch information
PieterOlivier committed Nov 4, 2024
1 parent 777145f commit 13e29dd
Showing 1 changed file with 8 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,18 @@ import Exception;

lexical C = C C C | "a"@2 | "b";

test bool testA() {
bool testParse(str input, bool shouldParse) {
try {
parse(#C, "a");
} catch ParseError(e): {
return true;
parse(#C, input);
} catch ParseError(_): {
return !shouldParse;
}

return false;
return shouldParse;
}

test bool testBab() {
try {
parse(#C, "bab");
} catch ParseError(e): {
return true;
}

return false;
}
test bool testA() = testParse("a", false);

test bool testBba() {
try {
parse(#C, "bba");
} catch ParseError(e): {
return false;
}
test bool testBab() = testParse("bab", false);

return true;
}
test bool testBba() = testParse("bba", true);

0 comments on commit 13e29dd

Please sign in to comment.