Another type assumption parser test

This commit is contained in:
Arne Keller 2021-06-29 14:50:42 +02:00
parent 602f6e04c4
commit 5a79fc64de

View File

@ -212,6 +212,21 @@ class TypeAssumptionParserTest {
), quantified), assumption.getValue());
}
@Test
void usefulErrors() {
TypeAssumptionParser parser = new TypeAssumptionParser();
Map<String, String> assumptions = new HashMap<>();
assumptions.put("id", "∀ t1");
Result<Map<VarTerm, TypeAbstraction>, ParseError> type = parser.parse(assumptions);
assertTrue(type.isError());
ParseError error = type.unwrapError();
assertEquals(ParseError.TOO_FEW_TOKENS, error);
Collection<Token.TokenType> expected = error.getExpected().get();
assertEquals(1, expected.size());
assertTrue(expected.contains(Token.TokenType.DOT));
// TODO: should also expect a comma, once the parser is fixed!
}
@Test
void errors() {
Map<String, ParseError> tests = new HashMap<>();