format.lisp (879B)
1 (in-package :miniblog/tests) 2 3 (in-suite miniblog-test) 4 5 (test test-date-formatters 6 "Validate that date formatters return expected results" 7 (let* ((*default-timezone* +utc-zone+) 8 (ts (encode-timestamp 0 0 0 12 20 4 2020))) 9 (is (string= "Mon, 20 Apr 2020 12:00:00 +0000" (miniblog.format:rfc-822-format ts))) 10 (is (string= "2020-04-20" (miniblog.format:short-date-format ts))) 11 (is (string= "Monday, April 20th 2020 at 12:00 pm UTC" (miniblog.format:long-date-format ts))))) 12 13 (test test-markdown-formatter 14 "Simple validation that the Markdown formatter works" 15 (let* ((html (miniblog.format:markdown "# foo")) 16 (html-frag (parse-html5-fragment html)) 17 (maybe-h1 (node-first-child html-frag)) 18 (maybe-text (node-first-child maybe-h1))) 19 (is (string= "h1" (node-name maybe-h1))) 20 (is (string= "foo" (node-value maybe-text)))))