1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-08 17:59:55 +00:00

Add some tests for assertf

This commit is contained in:
sogaiu 2024-10-30 23:41:31 +09:00
parent abad9d7db9
commit 10994cbc6a

View File

@ -986,4 +986,14 @@
(assert (deep= (get (dyn 'a) :source-form) source))
(setdyn *debug* nil)
# issue #1516
(assert (assertf true) "assertf 1 argument")
(assert (assertf true "fun message") "assertf 2 arguments")
(assert (assertf true "%s message" "mystery") "assertf 3 arguments")
(assert (assertf (not nil) "%s message" "ordinary") "assertf not nil")
(assert-error "assertf error 1" (assertf false))
(assert-error "assertf error 2" (assertf false "fun message"))
(assert-error "assertf error 3" (assertf false "%s message" "mystery"))
(assert-error "assertf error 4" (assertf nil "%s %s" "alice" "bob"))
(end-suite)