From 5a79fc64de7d36ce8d47ab37fd1cef52c8b204af Mon Sep 17 00:00:00 2001 From: Arne Keller Date: Tue, 29 Jun 2021 14:50:42 +0200 Subject: [PATCH] Another type assumption parser test --- .../model/parser/TypeAssumptionParserTest.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/test/java/edu/kit/typicalc/model/parser/TypeAssumptionParserTest.java b/src/test/java/edu/kit/typicalc/model/parser/TypeAssumptionParserTest.java index 1c6018f..7bcac09 100644 --- a/src/test/java/edu/kit/typicalc/model/parser/TypeAssumptionParserTest.java +++ b/src/test/java/edu/kit/typicalc/model/parser/TypeAssumptionParserTest.java @@ -212,6 +212,21 @@ class TypeAssumptionParserTest { ), quantified), assumption.getValue()); } + @Test + void usefulErrors() { + TypeAssumptionParser parser = new TypeAssumptionParser(); + Map assumptions = new HashMap<>(); + assumptions.put("id", "∀ t1"); + Result, ParseError> type = parser.parse(assumptions); + assertTrue(type.isError()); + ParseError error = type.unwrapError(); + assertEquals(ParseError.TOO_FEW_TOKENS, error); + Collection 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 tests = new HashMap<>();