mirror of
https://github.com/janet-lang/janet
synced 2024-11-19 23:24:49 +00:00
Add a few more tests.
This commit is contained in:
parent
5fcb0095d4
commit
45f8db0360
@ -69,6 +69,11 @@
|
||||
(var plus +)
|
||||
(assert (= 22 (plus one (plus 1 2 two) (plus 8 (plus zero 1) 4 three))) "nested function calls")
|
||||
|
||||
# String literals
|
||||
(assert (= "abcd" "\x61\x62\x63\x64") "hex escapes")
|
||||
(assert (= "\e" "\x1B") "escape character")
|
||||
(assert (= "\x09" "\t") "tab character")
|
||||
|
||||
# Mcarthy's 91 function
|
||||
(var f91 nil)
|
||||
(:= f91 (fn [n] (if (> n 100) (- n 10) (f91 (f91 (+ n 11))))))
|
||||
|
@ -39,5 +39,12 @@
|
||||
|
||||
(assert (= (length @"abcdef") 6) "buffer length")
|
||||
|
||||
# Looping idea
|
||||
(def xs
|
||||
(for [x :in '[-1 0 1], y :in '[-1 0 1] :when (not= x y 0)] (tuple x y)))
|
||||
(def txs (apply1 tuple xs))
|
||||
|
||||
(assert (= txs '[[-1 -1] [-1 0] [-1 1] [0 -1] [0 1] [1 -1] [1 0] [1 1]]) "nested for")
|
||||
|
||||
(end-suite)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user