Tests for Parser

This commit is contained in:
Michael Schimmel
2025-11-25 14:40:04 +01:00
parent 29c36c7ae0
commit d84509c034
6 changed files with 172 additions and 73 deletions
+5 -5
View File
@@ -356,27 +356,27 @@ end;
procedure TTestMycAstScript.Parser_Error_UnbalancedParens_MissingRight;
begin
// FIX 2: Pass explicit Exception type to WillRaise
Assert.WillRaise(procedure begin Parse('(a b'); end, Exception);
Assert.WillRaise(procedure begin Parse('(a b'); end, EParserException);
end;
procedure TTestMycAstScript.Parser_Error_UnbalancedParens_ExtraRight;
begin
Assert.WillRaise(procedure begin Parse('a )'); end, Exception);
Assert.WillRaise(procedure begin Parse('a )'); end, EParserException);
end;
procedure TTestMycAstScript.Parser_Error_UnterminatedString;
begin
Assert.WillRaise(procedure begin Parse('"hello'); end, Exception);
Assert.WillRaise(procedure begin Parse('"hello'); end, EParserException);
end;
procedure TTestMycAstScript.Parser_Error_EmptyList;
begin
Assert.WillRaise(procedure begin Parse('()'); end, Exception);
Assert.WillRaise(procedure begin Parse('()'); end, EParserException);
end;
procedure TTestMycAstScript.Parser_Error_Record_MissingValue;
begin
Assert.WillRaise(procedure begin Parse('{:a 1 :b}'); end, Exception);
Assert.WillRaise(procedure begin Parse('{:a 1 :b}'); end, EParserException);
end;
end.