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

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

[nongnu] elpa/org-journal eab8f64251 3/7: Merge branch 'fix-broken-tests


From: ELPA Syncer
Subject: [nongnu] elpa/org-journal eab8f64251 3/7: Merge branch 'fix-broken-tests' into fix-merge-420
Date: Sat, 6 Jan 2024 13:00:04 -0500 (EST)

branch: elpa/org-journal
commit eab8f642519e837c361690b93921ed7d42c8c955
Merge: 81bd35f192 09541d9d04
Author: Jason May <jmay@pobox.com>
Commit: Jason May <jmay@pobox.com>

    Merge branch 'fix-broken-tests' into fix-merge-420
---
 tests/org-journal-test.el | 108 ++++++++++++++++++++++++----------------------
 1 file changed, 56 insertions(+), 52 deletions(-)

diff --git a/tests/org-journal-test.el b/tests/org-journal-test.el
index c43289d451..8ab3ab861f 100644
--- a/tests/org-journal-test.el
+++ b/tests/org-journal-test.el
@@ -107,58 +107,59 @@
 (ert-deftest org-journal-insert-header-test ()
   "Test insertion of header"
   (org-journal-test-macro
-      (let ((org-journal-file-header "#+TITLE: Some header\n#+STARTUP: 
folded"))
-        (let ((inhibit-message t))
-          (org-journal-new-entry t))
-        (save-buffer)
-        (kill-buffer)
-        (should (string= (with-temp-buffer
-                           (insert-file-contents (org-journal--get-entry-path))
-                           (buffer-substring-no-properties (point-min) 
(point-max)))
-                         (concat org-journal-file-header "\n* Test 
header\n"))))))
+   (let ((org-journal-file-header "#+TITLE: Some header\n#+STARTUP: folded"))
+     (let ((inhibit-message t))
+       (org-journal-new-entry t))
+     (save-buffer)
+     (kill-buffer)
+     (should (string= (with-temp-buffer
+                        (insert-file-contents (org-journal--get-entry-path))
+                        (buffer-substring-no-properties (point-min) 
(point-max)))
+                      (concat org-journal-file-header "\n* Test header\n"))))))
 
 (ert-deftest org-journal-carryover-items-test ()
   "Org journal new entry test."
   (org-journal-test-macro
-      (let ((org-journal-file-type 'weekly)
-            ;; Always use english as time locale.
-            (system-time-locale "C")
-            (buffer "20181231"))
-        (with-temp-buffer
-          (insert "* Tuesday, 01/01/19\n")
-          (org-set-property "CREATED" "20190101")
-          (insert "** 13:00 Some journal entry\n")
-          (insert "* Wednesday, 01/02/19\n")
-          (org-set-property "CREATED" "20190102")
-          (insert "** TODO First\n")
-          (insert "** 13:00 Some journal entry 1\n")
-          (insert "** TODO Second\n")
-          (insert "** 14:00 Some journal entry 2\n")
-          (write-file (expand-file-name buffer org-journal-dir-test))
-          (kill-buffer buffer))
-        (find-file (expand-file-name buffer org-journal-dir-test))
-        (should (not (stringp (org-journal-read-or-display-entry (encode-time 
0 0 0 1 1 2019)))))
-        (kill-buffer buffer)
-        (should (not (stringp (org-journal-read-or-display-entry (encode-time 
0 0 0 2 1 2019)))))
-        (kill-buffer buffer)
-        (org-journal-new-entry t)
-        (save-buffer)
-        (kill-buffer) ;; Kills new journal file buffer
-        (kill-buffer buffer)
-        (should (not (stringp (org-journal-read-or-display-entry (encode-time 
0 0 0 1 1 2019)))))
-        (kill-buffer)
-        (should (not (stringp (org-journal-read-or-display-entry (encode-time 
0 0 0 2 1 2019)))))
-        (kill-buffer)
+   (let ((org-journal-file-type 'weekly)
+         ;; Always use english as time locale.
+         (system-time-locale "C")
+         (buffer "20181231"))
+     (with-temp-buffer
+       (org-journal-mode)
+       (insert "* Tuesday, 01/01/19\n")
+       (org-set-property "CREATED" "20190101")
+       (insert "** 13:00 Some journal entry\n")
+       (insert "* Wednesday, 01/02/19\n")
+       (org-set-property "CREATED" "20190102")
+       (insert "** TODO First\n")
+       (insert "** 13:00 Some journal entry 1\n")
+       (insert "** TODO Second\n")
+       (insert "** 14:00 Some journal entry 2\n")
+       (write-file (expand-file-name buffer org-journal-dir-test))
+       (kill-buffer buffer))
+     (find-file (expand-file-name buffer org-journal-dir-test))
+     (should (not (stringp (org-journal-read-or-display-entry (encode-time 0 0 
0 1 1 2019)))))
+     (kill-buffer buffer)
+     (should (not (stringp (org-journal-read-or-display-entry (encode-time 0 0 
0 2 1 2019)))))
+     (kill-buffer buffer)
+     (org-journal-new-entry t)
+     (save-buffer)
+     (kill-buffer) ;; Kills new journal file buffer
+     (kill-buffer buffer)
+     (should (not (stringp (org-journal-read-or-display-entry (encode-time 0 0 
0 1 1 2019)))))
+     (kill-buffer)
+     (should (not (stringp (org-journal-read-or-display-entry (encode-time 0 0 
0 2 1 2019)))))
+     (kill-buffer)
 
-        (should (string= (with-temp-buffer
-                           (org-journal-mode)
-                           (insert-file-contents (org-journal--get-entry-path))
-                           (replace-regexp-in-string
-                            "^[ ]*" ""
-                            (buffer-substring-no-properties (point-min) 
(point-max))))
-                         (concat "* Test header\n:PROPERTIES:\n:CREATED:  "
-                                 (format-time-string 
org-journal-created-property-timestamp-format)
-                                 "\n:END:\n** TODO First\n** TODO 
Second\n"))))))
+     (should (string= (with-temp-buffer
+                        (org-journal-mode)
+                        (insert-file-contents (org-journal--get-entry-path))
+                        (replace-regexp-in-string
+                         "^[ ]*" ""
+                         (buffer-substring-no-properties (point-min) 
(point-max))))
+                      (concat "* Test header\n:PROPERTIES:\n:CREATED:  "
+                              (format-time-string 
org-journal-created-property-timestamp-format)
+                              "\n:END:\n** TODO First\n** TODO Second\n"))))))
 
 (ert-deftest org-journal-carryover-keep-parents-test ()
   "Org journal new entry test for daily files."
@@ -199,6 +200,7 @@
             (org-journal-carryover-delete-empty-journal 'always))
         ;; Test that journal file gets dumped, after carryover
         (with-temp-buffer
+          (org-journal-mode)
           (insert "* Wednesday, 01/02/19\n")
           (insert "** TODO a\n")
           (write-file (expand-file-name buffer org-journal-dir-test))
@@ -212,6 +214,7 @@
         (org-journal-dir-test-setup)
         (setq org-journal-file-type 'yearly)
         (with-temp-buffer
+          (org-journal-mode)
           (insert "* Wednesday, 01/01/19\n")
           (org-set-property "CREATED" "20190101")
           (insert "** TODO a\n")
@@ -223,10 +226,11 @@
         (org-journal-new-entry nil)
         (save-buffer)
         (kill-buffer)
-        (let ((inhibit-message t))
-          (should
-           (string= "No journal entry for this date."
-                    (org-journal-read-or-display-entry (encode-time 0 0 0 2 1 
2019) 'noselect)))))))
+        (let ((message-marker nil))
+          (fset 'message (lambda (x y) (setq message-marker x)))
+          (org-journal-read-or-display-entry (encode-time 0 0 0 2 1 2019) 
'noselect)
+          (should (equal "No journal entry for this date." message-marker))
+          ))))
 
 (ert-deftest org-journal-search-build-file-list-test ()
   "Test for `org-journal--search-build-file-list'."
@@ -344,7 +348,7 @@
                ;; "   "
                ;; org-scheduled-string
                ;; " "
-               (scheduled-string (concat (format-time-string (cdr 
org-time-stamp-formats) scheduled-entry-time))))
+               (scheduled-string (concat "<" (format-time-string (cdr 
org-time-stamp-formats) scheduled-entry-time) ">")))
           ;; Add first scheduled entry
           (org-journal-new-scheduled-entry nil scheduled-entry-time)
           (insert "Task 1")



reply via email to

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