scm: implement field / fields procedures

Add procedures field & fields to get information about mu's database
fields, similar to "mu info fields".

Add docs & tests as well.
This commit is contained in:
Dirk-Jan C. Binnema
2026-07-26 13:00:19 +03:00
committed by Seth Ladygo
parent 5235e16f54
commit 702da53ad9
6 changed files with 112 additions and 5 deletions

View File

@ -110,7 +110,7 @@
;; language
(test-equal (language msg)
(if (assoc-ref (configuration) 'language-enabled?) 'en nil))
(if (assoc-ref (configuration) 'language-enabled?) 'en #f))
;; cc, bc, labels
(test-equal '() (cc msg))
@ -197,6 +197,13 @@
(test-equal "2025-06-16 15:43:12" (time->string 1750077792 #:utc? #f))
(test-equal "12:43:12" (time->string 1750077792 #:utc? #t #:format "%T"))
(let* ((subject (field 'subject)))
(test-assert subject)
(test-equal (assoc-ref subject 'name) "subject")
(test-equal (assoc-ref subject 'shortcut) #\s)
(test-equal (assoc-ref subject 'search-type) 'phrase)
(test-assert (assoc-ref subject 'value?)))
;; (define old-prefs %preferences)
;; (define %preferences '((utc? . #t) (short-date . "%T %F")))
;; (test-equal "12:43:12 2025-06-16" (time->string 1750077792))