1
0
mirror of https://github.com/janet-lang/janet synced 2025-10-30 23:23:07 +00:00

Add gensym

This commit is contained in:
bakpakin
2017-07-16 11:00:20 -04:00
parent 9187d4c1e2
commit 3ccd688438
4 changed files with 87 additions and 3 deletions

View File

@@ -111,6 +111,18 @@
(assert (= 110 (vargf 1 2 3 4)) "var arg tuple size 3")
(assert (= 210 (vargf 1 2 3 4 10 10 10 10 10 10 10 10 10 10)) "var arg large tuple")
# Gensym tests
(assert (not= (gensym) (gensym)) "two gensyms not equal")
(assert (not= (gensym 'abc) (gensym 'abc)) "two gensyms with arg not equal")
((fn []
(def syms (table))
(var count 0)
(while (< count 128)
(set! syms (gensym 'beep) true)
(varset! count (+ 1 count)))
(assert (= (length syms) 128) "many symbols")))
# report
(print "\n" num-tests-passed " of " num-tests-run " tests passed\n")