From b14d7a55ac99347a4b52cef8012496cdf0a8229d Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Sat, 24 Mar 2012 22:01:56 +0000 Subject: [PATCH] Add ASSERT macro. --- src/runtime/mit-macros.scm | 8 +++++++- src/runtime/runtime.pkg | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/runtime/mit-macros.scm b/src/runtime/mit-macros.scm index 4888170f1..76efa17e2 100644 --- a/src/runtime/mit-macros.scm +++ b/src/runtime/mit-macros.scm @@ -600,4 +600,10 @@ USA. ((BEGIN0 form0 form1+ ...) (LET ((RESULT form0)) form1+ ... - RESULT)))) \ No newline at end of file + RESULT)))) + +(define-syntax :assert + (syntax-rules () + ((ASSERT condition) + (IF (NOT condition) + (ERROR "Assertion failed:" 'condition))))) \ No newline at end of file diff --git a/src/runtime/runtime.pkg b/src/runtime/runtime.pkg index 67dd38317..15198d565 100644 --- a/src/runtime/runtime.pkg +++ b/src/runtime/runtime.pkg @@ -4766,6 +4766,7 @@ USA. (access :access) (and :and) (and-let* :and-let*) + (assert :assert) (begin0 :begin0) (case :case) (cond :cond) -- 2.25.1