lib/lisp/tests/boot-tests.nydp in nydp-0.1.0 vs lib/lisp/tests/boot-tests.nydp in nydp-0.1.1
- old
+ new
@@ -64,10 +64,18 @@
("single-item brace list is just the thing itself"
(let zi 10 "finds the ~{zi}th item")
"finds the 10th item")
+ ("detects key presence"
+ (hash-key? { foo 1 bar 2 } 'foo)
+ t)
+
+ ("detects key absence"
+ (hash-key? { foo 1 bar 2 } 'zed)
+ nil)
+
("unquotes hash keys"
(with (zi 'foo chi 'bar yi 'grr)
(let hsh { ,zi 10 ,chi 11 ,yi 12 }
(list zi hsh.foo chi hsh.bar yi hsh.grr)))
(foo 10 bar 11 grr 12))
@@ -76,15 +84,10 @@
(with (zi "hello" chi "world")
(let hsh { (joinstr " " zi chi) 10 "yesterday" 11 }
(list "hello world" (hash-get hsh "hello world") "yesterday" (hash-get hsh "yesterday"))))
("hello world" 10 "yesterday" 11)))
- (suite "strings"
- ("length"
- (len "foo-bar")
- 7))
-
(suite "list management"
("'pair breaks a list into pairs"
(pairs '(1 a 2 b 3 c))
((1 a) (2 b) (3 c)))
@@ -97,29 +100,9 @@
nil)
("'rev doesn't recurse"
(rev '(a b (c d e) f g))
(g f (c d e) b a))
-
- ("joins elements into a string"
- (joinstr "" '("foo" "bar" "bax"))
- "foobarbax")
-
- ("joins separate elements into a string"
- (joinstr "/" "foo" "bar" "bax")
- "foo/bar/bax")
-
- ("joins a single thing"
- (joinstr "/" "foo")
- "foo")
-
- ("joins nested and separate elements into a string"
- (joinstr "/" "foo" "bar" '(twiddle diddle) "bax")
- "foo/bar/twiddle/diddle/bax")
-
- ("joins elements into a string"
- (joinstr " - " '(1 2 3))
- "1 - 2 - 3")
("'flatten returns a flat list of things"
(flatten '((poo (x) (* x x)) (1 2 3)))
(poo x * x x 1 2 3)))