Skip to content

Commit

Permalink
Fixed error propagation test
Browse files Browse the repository at this point in the history
  • Loading branch information
Bogdan Damian committed May 28, 2024
1 parent 1904738 commit 0687ede
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,16 @@ public void setup() {
}

@Test
void testOnlyElementErrorPropagation() {
String expected = "Logical Operation: Rightside is not of type Boolean\"";
RosettaExpression expr = parser.parseExpression("[(True or 2)] only-element");
void testOnlyElementError() {
RosettaInterpreterErrorValue expected =
new RosettaInterpreterErrorValue(
new RosettaInterpreterError("Logical Operation: "
+ "Rightside is not of type Boolean"));
RosettaExpression expr = parser.parseExpression("(True and 1) only-element");
RosettaInterpreterValue val = interpreter.interp(expr);
assertTrue(val instanceof RosettaInterpreterErrorValue);
String errorMessage = ((RosettaInterpreterErrorValue)val).getErrors().get(0).getMessage();
assertEquals(expected, errorMessage);
RosettaInterpreterErrorValue castedVal = (RosettaInterpreterErrorValue)val;
assertEquals(expected, castedVal);
}

@Test
Expand Down

0 comments on commit 0687ede

Please sign in to comment.