Compiler exceptions

This commit is contained in:
Michael Schimmel
2025-11-25 15:27:57 +01:00
parent d84509c034
commit 4e508d90a5
8 changed files with 62 additions and 28 deletions
+4 -3
View File
@@ -11,7 +11,8 @@ uses
Myc.Ast.Script,
Myc.Ast.Environment,
Myc.Data.Value,
Myc.Data.Scalar;
Myc.Data.Scalar,
Myc.Ast.Compiler.Macros;
type
[TestFixture]
@@ -239,12 +240,12 @@ end;
procedure TMacroTests.Test_Error_Unquote_Outside_Quasiquote;
begin
Assert.WillRaise(procedure begin Run('(print ~1)'); end, Exception, 'Unquote outside quasiquote should raise exception');
Assert.WillRaise(procedure begin Run('(print ~1)'); end, EMacroException, 'Unquote outside quasiquote should raise exception');
end;
procedure TMacroTests.Test_Macro_Argument_Count_Mismatch;
begin
Assert.WillRaise(procedure begin Run('(do (defmacro two [a b] `(+ ~a ~b)) (two 1))'); end, Exception);
Assert.WillRaise(procedure begin Run('(do (defmacro two [a b] `(+ ~a ~b)) (two 1))'); end, EMacroException);
end;
end.
-1
View File
@@ -355,7 +355,6 @@ end;
procedure TTestMycAstScript.Parser_Error_UnbalancedParens_MissingRight;
begin
// FIX 2: Pass explicit Exception type to WillRaise
Assert.WillRaise(procedure begin Parse('(a b'); end, EParserException);
end;