More tests for #9

This commit is contained in:
Arne Keller 2021-07-10 12:23:05 +02:00
parent 57064aa5f1
commit f3f3bbb77d

View File

@ -212,6 +212,23 @@ class LambdaParserTest {
assertTrue(error.getExpected().get().contains(TokenType.VARIABLE)); assertTrue(error.getExpected().get().contains(TokenType.VARIABLE));
} }
@Test
void doesntAcceptEmptyParens() {
LambdaParser parser = new LambdaParser("()");
ParseError error = parser.parse().unwrapError();
assertEquals(TokenType.RIGHT_PARENTHESIS, error.getCause().get().getType());
assertEquals(ExpectedInput.TERM, error.getExpectedInput().get());
}
@Test
void errorCase2() {
LambdaParser parser = new LambdaParser(")()");
ParseError error = parser.parse().unwrapError();
assertEquals(TokenType.RIGHT_PARENTHESIS, error.getCause().get().getType());
assertEquals(0, error.getCause().get().getPos());
assertEquals(ExpectedInput.TERM, error.getExpectedInput().get());
}
@Test @Test
void equality() { void equality() {
EqualsVerifier.forClass(Token.class).usingGetClass().verify(); EqualsVerifier.forClass(Token.class).usingGetClass().verify();