Skip to content

Commit d0954ff

Browse files
committed
testify assoc
1 parent 009a8d9 commit d0954ff

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

arc.arc

+1-1
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ For example, {a 1 b 2} => (%braces a 1 b 2) => (obj a 1 b 2)"
301301
"Finds a (key value) pair in an association list 'al' of such pairs."
302302
(if (no acons.al)
303303
nil
304-
(and (acons (car al)) (is (caar al) key))
304+
(and (acons (car al)) (testify.key (caar al)))
305305
(car al)
306306
(assoc key (cdr al))))
307307

arc.arc.t

+12
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,18 @@
1919
(test excludes-tagged-types
2020
(assert-nil (atom (annotate 'foo 34)))))
2121

22+
(suite assoc
23+
(test key-found
24+
(assert-same '(b . 4)
25+
(assoc 'b '((a . 3) (b . 4)))))
26+
(test not-found
27+
(assert-nil (assoc 'c '((a . 3) (b . 4)))))
28+
(test predicate-match
29+
(assert-same '(4 . 13)
30+
(assoc even '((4 . 13) (5 . 15)))))
31+
(test predicate-fail
32+
(assert-nil (assoc even '((3 . 13) (5 . 15))))))
33+
2234
(suite memtable
2335
(test no-args
2436
(assert-same (obj) (memtable)))

0 commit comments

Comments
 (0)