From 4b4bcc9dc12b35f97f6ad5b8e493132e59cd4a25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20Pospi=CC=81s=CC=8Cil?= Date: Tue, 13 Dec 2022 09:23:42 +0100 Subject: [PATCH] Message for asserted is optional --- eleanor/points.janet | 2 +- test/suite01.janet | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/eleanor/points.janet b/eleanor/points.janet index d668333..4ab001d 100644 --- a/eleanor/points.janet +++ b/eleanor/points.janet @@ -303,5 +303,5 @@ (defn asserted "Asserts `pred` on the `base` and errors with `msg` if it fails." - [pred msg] + [pred &opt msg] (fn [base] (assert (pred base) msg))) diff --git a/test/suite01.janet b/test/suite01.janet index 8c629d0..43d8f01 100644 --- a/test/suite01.janet +++ b/test/suite01.janet @@ -404,4 +404,10 @@ (assert-error "asserted" ((=> (asserted nil? "must be nil")) true)) +(assert-error "asserted" ((=> (asserted nil?)) true)) + +(assert-no-error "asserted" ((=> (asserted nil? "must be nil")) nil)) + +(assert-no-error "asserted" ((=> (asserted nil?)) nil)) + (end-suite) -- 2.38.5