From 88a32f19180e36ce31f1819171ce9a9337c70568 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Thu, 5 Sep 2024 18:56:24 +0300 Subject: edit-update-note: Update assertions. * Update assertions, to avoid edits that will lead to bugs such as inserting numbers to the tags list. --- gnosis.el | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/gnosis.el b/gnosis.el index db5a6f4..a722fe1 100644 --- a/gnosis.el +++ b/gnosis.el @@ -1986,10 +1986,12 @@ SUSPEND: Suspend note, 0 for unsuspend, 1 for suspend" "Second-image must be a string, path to image file from `gnosis-images-dir', or nil") (cl-assert (or (stringp extra-notes) (null extra-notes)) nil "Extra-notes must be a string, or nil") - (cl-assert (listp tags) nil "Tags must be a list of strings") - (cl-assert (and (listp gnosis) (length= gnosis 3)) nil "gnosis must be a list of 3 floats") - (cl-assert (or (stringp options) (listp options)) nil "Options must be a string, or a list for MCQ") - (cl-assert (or (= suspend 0) (= suspend 1)) nil "Suspend must be either 0 or 1") + (cl-assert (and (listp tags) (cl-every #'stringp tags)) nil "Tags must be a list of strings") + (cl-assert (and (listp gnosis) (length= gnosis 3) (cl-every #'floatp gnosis)) + nil "gnosis must be a list of 3 floats") + (cl-assert (or (stringp options) (and (listp options) (cl-every #'stringp options))) + nil "Options must be a string or a list of strings") + (cl-assert (and (numberp suspend) (or (= suspend 0) (= suspend 1))) nil "Suspend must be either 0 or 1") (when (and (string= (gnosis-get-type id) "cloze") (not (stringp options))) (cl-assert (or (listp options) (stringp options)) nil "Options must be a list or a string.") -- cgit v1.2.3