diff options
| author | Timo Wilken | 2025-04-28 15:46:01 +0200 |
|---|---|---|
| committer | Timo Wilken | 2025-04-28 15:46:01 +0200 |
| commit | 6a2678d522563e27eca04cd00c326141ffb0bbb8 (patch) | |
| tree | bd11bbe438d0ef28804ea12b1cb0699de3d2c1b0 | |
| parent | db2c22c0372b084398f4a0ffe9b60be2321f8021 (diff) | |
| -rw-r--r-- | t/tests.lisp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/t/tests.lisp b/t/tests.lisp index d7863a1..20862a2 100644 --- a/t/tests.lisp +++ b/t/tests.lisp @@ -7,6 +7,29 @@ :description "Check that ledgerplot behaves correctly.") (in-suite :ledgerplot) +(test assoc-path + ;; Simple cases. + (is (equalp 'foo (ledgerplot::assoc-path 'foo))) + (is (equalp 'foo (ledgerplot::assoc-path '(foo) 0))) + (is (equalp 0 (ledgerplot::assoc-path '((:foo . 0)) :foo))) + ;; Make sure the example in the docstring works. + (is (equalp 1 (ledgerplot::assoc-path + '((a . ((b . (0 1 2))))) + 'a 'b 1))) + ;; A moderately complex example, involving alists and lists, with values + ;; that mustn't be used. + (is (equalp :yes (ledgerplot::assoc-path + '((:foo . :no) + (:bar . :also-no) + (:quux . + (:no :no ((:key . :yes)))) + (:qax . ((:no :no :no)))) + :quux 2 :key))) + ;; Missing keys raise an error. + (signals t (ledgerplot::assoc-path '((bar . t)) 'foo)) + ;; Lists rely on `nth' behaviour; null for entries past the end. + (is (null (ledgerplot::assoc-path '(foo) 10)))) + (test narrow-range (let ((today (local-time:format-timestring nil (local-time:today) |
