bastibe / org-journal

A simple org-mode based journaling mode
BSD 3-Clause "New" or "Revised" License
1.25k stars 124 forks source link

ert test fails for org-journal #404

Closed jmay closed 1 year ago

jmay commented 1 year ago

I'm learning how ert works. org-journal has an ert test suite.

When I run the test suite, there is a single failure out of 10 tests.

I have a fix for this, but wanted to verify that others see this error, since I'm unfamiliar with the tool.

To run the tests, I am executing this from the command line in the org-journal directory:

emacs -batch -l ert -l org-journal.el -l tests/org-journal-test.el -f ert-run-tests-batch-and-exit

Full output from the batch command:

Running 10 tests (2022-11-30 16:44:19-0800, selector ‘t’)
   passed   1/10  org-journal-calendar-date-from-file-test (0.001045 sec)
   passed   2/10  org-journal-carryover-delete-empty-journal-test (0.830385 sec)
/private/var/folders/1w/9g63cjy91lx_yz74py0qgpw00000gn/T/org-journal-6kGuUO/20181231 and /var/folders/1w/9g63cjy91lx_yz74py0qgpw00000gn/T/org-journal-6kGuUO/20181231 are the same file
/private/var/folders/1w/9g63cjy91lx_yz74py0qgpw00000gn/T/org-journal-6kGuUO/20181231 and /var/folders/1w/9g63cjy91lx_yz74py0qgpw00000gn/T/org-journal-6kGuUO/20181231 are the same file
   passed   3/10  org-journal-carryover-items-test (0.045122 sec)
   passed   4/10  org-journal-carryover-keep-parents-test (0.014721 sec)
   passed   5/10  org-journal-convert-time-to-file-type-time-test (0.000429 sec)
   passed   6/10  org-journal-insert-header-test (0.023784 sec)
   passed   7/10  org-journal-scheduled-carryover-daily-test (0.015132 sec)
   passed   8/10  org-journal-scheduled-carryover-yearly-test (0.028051 sec)
Test org-journal-scheduled-weekly-test backtrace:
  signal(ert-test-failed (((should (equal (buffer-substring-no-propert
  ert-fail(((should (equal (buffer-substring-no-properties (point-min)
  (if (unwind-protect (setq value-104 (apply fn-102 args-103)) (setq f
  (let (form-description-106) (if (unwind-protect (setq value-104 (app
  (let ((value-104 'ert-form-evaluation-aborted-105)) (let (form-descr
  (let* ((fn-102 #'equal) (args-103 (condition-case err (let ((signal-
  (let* ((scheduled-entry-date (calendar-current-date day-offset)) (sc
  (let ((org-journal-file-type 'weekly) (org-journal-start-on-weekday
  (let* ((org-journal-dir (concat org-journal-dir-test "-link")) (comm
  (let ((lexical-binding t)) (let* ((org-journal-dir (concat org-journ
  (closure (t) nil (let ((lexical-binding t)) (let* ((org-journal-dir
  ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
  ert-run-test(#s(ert-test :name org-journal-scheduled-weekly-test :do
  ert-run-or-rerun-test(#s(ert--stats :selector t :tests ... :test-map
  ert-run-tests(t #f(compiled-function (event-type &rest event-args) #
  ert-run-tests-batch(nil)
  ert-run-tests-batch-and-exit()
  command-line-1(("-l" "ert" "-l" "org-journal.el" "-l" "tests/org-jou
  command-line()
  normal-top-level()
Test org-journal-scheduled-weekly-test condition:
    (ert-test-failed
     ((should
       (equal
    (buffer-substring-no-properties ... ...)
    (with-temp-buffer ... ...)))
      :form
      (equal "* Test header\n:PROPERTIES:\n:CREATED:  20221130\n:END:\n* Test header\n:PROPERTIES:\n:CREATED:  20221201\n:END:\n** TODO Task 1\n<2022-12-01 Thu 00:00>\n** TODO Task 2\n<2022-12-01 Thu 00:00>" "* Test header\n  :PROPERTIES:\n  :CREATED:  20221130\n  :END:\n* Test header\n  :PROPERTIES:\n  :CREATED:  20221201\n  :END:\n** TODO Task 1\n<2022-12-01 Thu 00:00>\n** TODO Task 2\n<2022-12-01 Thu 00:00>")
      :value nil :explanation
      (arrays-of-different-length 181 193 "* Test header\n:PROPERTIES:\n:CREATED:  20221130\n:END:\n* Test header\n:PROPERTIES:\n:CREATED:  20221201\n:END:\n** TODO Task 1\n<2022-12-01 Thu 00:00>\n** TODO Task 2\n<2022-12-01 Thu 00:00>" "* Test header\n  :PROPERTIES:\n  :CREATED:  20221130\n  :END:\n* Test header\n  :PROPERTIES:\n  :CREATED:  20221201\n  :END:\n** TODO Task 1\n<2022-12-01 Thu 00:00>\n** TODO Task 2\n<2022-12-01 Thu 00:00>" first-mismatch-at 14)))
   FAILED   9/10  org-journal-scheduled-weekly-test (0.004392 sec)
   passed  10/10  org-journal-search-build-file-list-test (0.070135 sec)

Ran 10 tests, 9 results as expected, 1 unexpected (2022-11-30 16:44:20-0800, 1.169327 sec)

1 unexpected results:
   FAILED  org-journal-scheduled-weekly-test
bastibe commented 1 year ago

If you already have a patch, please to open a pull request! That will be a better place to discuss the issue anyway.