emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/denote 1d24172f96 2/4: Improve and expand denote-test--


From: ELPA Syncer
Subject: [elpa] externals/denote 1d24172f96 2/4: Improve and expand denote-test--denote--format-front-matter
Date: Tue, 28 Nov 2023 03:57:49 -0500 (EST)

branch: externals/denote
commit 1d24172f96cecbcb9319da585554c9911019743c
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>

    Improve and expand denote-test--denote--format-front-matter
---
 tests/denote-test.el | 99 ++++++++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 84 insertions(+), 15 deletions(-)

diff --git a/tests/denote-test.el b/tests/denote-test.el
index fe24240080..b411c4e960 100644
--- a/tests/denote-test.el
+++ b/tests/denote-test.el
@@ -185,27 +185,96 @@ Extend what we do in 
`denote-test--denote-file-type-extensions'."
 (ert-deftest denote-test--denote--format-front-matter ()
   "Test that `denote--format-front-matter' formats front matter correctly."
   (should (and (equal (denote--format-front-matter "" "" '("") "" 'text)
-                      "title:
-date:
-tags:
-identifier:
----------------------------
+                      (mapconcat #'identity
+                                 '("title:      "
+                                   "date:       "
+                                   "tags:       "
+                                   "identifier: "
+                                   "---------------------------\n\n")
+                                 "\n"))
 
-")
                (equal
-                ;; (denote--format-front-matter
-                ;;  "Some test" (denote--date nil 'org) '("one" "two")
-                ;;  (format-time-string denote-id-format nil) 'org)
                 (denote--format-front-matter
                  "Some test" "2023-06-05" '("one" "two")
                  "20230605T102234" 'text)
-                "title:      Some test
-date:       2023-06-05
-tags:       one  two
-identifier: 20230605T102234
----------------------------
+                (mapconcat #'identity
+                           '("title:      Some test"
+                             "date:       2023-06-05"
+                             "tags:       one  two"
+                             "identifier: 20230605T102234"
+                             "---------------------------\n\n")
+                           "\n"))))
+
+  (should (and (equal (denote--format-front-matter "" "" nil "" 'org)
+                      (mapconcat #'identity
+                                 '("#+title:      "
+                                   "#+date:       "
+                                   "#+filetags:   "
+                                   "#+identifier: "
+                                   "\n")
+                                 "\n"))
 
-"))))
+               (equal
+                (denote--format-front-matter
+                 "Some test" "2023-06-05" '("one" "two")
+                 "20230605T102234" 'org)
+                (mapconcat #'identity
+                           '("#+title:      Some test"
+                             "#+date:       2023-06-05"
+                             "#+filetags:   :one:two:"
+                             "#+identifier: 20230605T102234"
+                             "\n")
+                           "\n"))))
+
+  (should (and (equal (denote--format-front-matter "" "" nil "" 'markdown-yaml)
+                      (mapconcat #'identity
+                                 '("---"
+                                   "title:      \"\""
+                                   "date:       "
+                                   "tags:       []"
+                                   "identifier: \"\""
+                                   "---"
+                                   "\n")
+                                 "\n"))
+
+               (equal
+                (denote--format-front-matter
+                 "Some test" "2023-06-05" '("one" "two")
+                 "20230605T102234" 'markdown-yaml)
+                (mapconcat #'identity
+                           '("---"
+                             "title:      \"Some test\""
+                             "date:       2023-06-05"
+                             "tags:       [\"one\", \"two\"]"
+                             "identifier: \"20230605T102234\""
+                             "---"
+                             "\n")
+                           "\n"))))
+
+(should (and (equal (denote--format-front-matter "" "" nil "" 'markdown-toml)
+                    (mapconcat #'identity
+                               '("+++"
+                                 "title      = \"\""
+                                 "date       = "
+                                 "tags       = []"
+                                 "identifier = \"\""
+                                 "+++"
+                                 "\n")
+                               "\n"))
+
+             (equal
+              (denote--format-front-matter
+               "Some test" "2023-06-05" '("one" "two")
+               "20230605T102234" 'markdown-toml)
+              (mapconcat #'identity
+                         '("+++"
+                           "title      = \"Some test\""
+                           "date       = 2023-06-05"
+                           "tags       = [\"one\", \"two\"]"
+                           "identifier = \"20230605T102234\""
+                           "+++"
+                           "\n")
+                         "\n")))))
 
 ;; ;; NOTE 2023-06-30: The following needs to be reviewed.
 ;;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]