summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFilip Lajszczak <filip@lajszczak.dev>2023-11-05 16:44:11 +0000
committerDavid Thompson <dthompson2@worcester.edu>2023-11-10 10:42:14 -0500
commitdac164892d549b8e4715518c77503efe0b65b5ba (patch)
tree3fe332156ba3b069f4aadec602740638230133fc /tests
parente6164fb80b35ae75caea484a23b56eac32fdf083 (diff)
post: Add convenience procedures for post author, tags, and title.
Author, tags and title metadata are commonly used, * haunt/post.scm (post-author, post-tags, post-title): New procedures. * tests/post.scm ("post-author, author metadata", "post-tags, tags metadata", "post-title, title metadata", "post-author, no metadata", "post-tags, no metadata", "post-title, no metadata"): New tests. * doc/haunt.texi (Posts): Docs for new procedures.
Diffstat (limited to 'tests')
-rw-r--r--tests/post.scm26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/post.scm b/tests/post.scm
index db1a82c..d01ed84 100644
--- a/tests/post.scm
+++ b/tests/post.scm
@@ -53,6 +53,32 @@
(list newest middle oldest)
(posts/reverse-chronological (list oldest newest middle))))
+ (let ((example-post (make-post "foo.skr"
+ '((author . "Eva Luator")
+ (tags "foo" "bar" "baz")
+ (title . "Hello, world!"))
+ '())))
+ (test-equal "post-author, author metadata"
+ "Eva Luator"
+ (post-author example-post))
+ (test-equal "post-tags, tags metadata"
+ '("foo" "bar" "baz")
+ (post-tags example-post))
+ (test-equal "post-title, title metadata"
+ "Hello, world!"
+ (post-title example-post)))
+
+ (let ((no-metadata-post (make-post "foo.skr" '() '())))
+ (test-equal "post-author, no metadata"
+ #f
+ (post-author no-metadata-post))
+ (test-equal "post-tags, no metadata"
+ '()
+ (post-tags no-metadata-post))
+ (test-equal "post-title, no metadata"
+ #f
+ (post-title no-metadata-post)))
+
(let ((foo-post (make-post "foo.skr" '((tags "foo")) '()))
(another-foo-post (make-post "another-foo.skr" '((tags "foo")) '()))
(bar-post (make-post "bar.skr" '((tags "bar")) '())))