summaryrefslogtreecommitdiff
path: root/gnosis.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-09-05 18:56:24 +0300
committerThanos Apollo <[email protected]>2024-09-05 18:56:24 +0300
commit88a32f19180e36ce31f1819171ce9a9337c70568 (patch)
treea74fbc30d584ae2d5dfa9032a0a2733b74748880 /gnosis.el
parent02a4e1352025e023d4345cd7dd71ae063d396538 (diff)
edit-update-note: Update assertions.
* Update assertions, to avoid edits that will lead to bugs such as inserting numbers to the tags list.
Diffstat (limited to 'gnosis.el')
-rw-r--r--gnosis.el10
1 files 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.")