summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2015-10-15 22:46:30 -0400
committerDavid Thompson <dthompson2@worcester.edu>2015-10-15 22:46:30 -0400
commitdfad89079b64b97e099f6d86e44b6d9deb76a5d5 (patch)
treeec838586a4d43f76bf91eb2e687111d36a1fcedf /tests
parente505a66a1b22132fd429c7699b7b632143d6653c (diff)
post: Add read-metadata-headers procedure.
* haunt/post.scm (read-metadata-headers): New procedure. * haunt/reader.scm (read-html-post): Reimplement using 'read-metadata-headers'. * tests/post.scm (%tzoffset): New variable. ("read-metadata-headers"): New test.
Diffstat (limited to 'tests')
-rw-r--r--tests/post.scm15
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/post.scm b/tests/post.scm
index bfc0d0e..38fcfbe 100644
--- a/tests/post.scm
+++ b/tests/post.scm
@@ -26,6 +26,8 @@
(define (make-date* year month day)
(make-date 0 0 0 0 day month year 0))
+(define %tzoffset (date-zone-offset (current-date)))
+
(test-equal "post-ref"
'(hello test)
(post-ref (make-post "foo.skr" '((tags hello test)) '()) 'tags))
@@ -62,9 +64,20 @@
(parse-metadata 'tags "foo, bar, baz"))
(test-equal "parse-metadata, date"
- (make-date 0 0 30 22 15 10 2015 (date-zone-offset (current-date)))
+ (make-date 0 0 30 22 15 10 2015 %tzoffset)
(parse-metadata 'date "2015-10-15 22:30"))
+(test-equal "read-metadata-headers"
+ `((tags "foo" "bar" "baz")
+ (date . ,(make-date 0 0 30 22 15 10 2015 %tzoffset))
+ (title . "Hello, World!"))
+ (pk 'meta (call-with-input-string "title: Hello, World!
+date: 2015-10-15 22:30
+tags: foo, bar, baz
+---
+"
+ read-metadata-headers)))
+
(test-end)