Skip to content

Add test for hyrolo-add#942

Merged
matsl merged 1 commit into
masterfrom
add_hyrolo_tests
May 10, 2026
Merged

Add test for hyrolo-add#942
matsl merged 1 commit into
masterfrom
add_hyrolo_tests

Conversation

@matsl
Copy link
Copy Markdown
Collaborator

@matsl matsl commented Apr 24, 2026

What

Add test for hyrolo-add

  • test/hyrolo-tests.el (hyrolo-tests--add--error-cases):
    (hyrolo-tests--add-item-to-new-file): Add tests.
    (hyrolo-tests--add-items-at-multiple-levels):
    (hyrolo-tests--add-items-interactive): Fix quotes in docstring.

Why

More test coverage for hyrolo.

Note

Testing write and read properties of files using root as user is
problematic since it behaves different for root than for a regular
user. This PR solved it by mocking the checks.

This shows a bigger problem. In the best of worlds we should be
running the tests as a regular user. That will require some work to
implement in our current setup.

@matsl matsl requested a review from rswgnu April 24, 2026 17:47
@rswgnu
Copy link
Copy Markdown
Owner

rswgnu commented Apr 25, 2026

If the first file in hyrolo-file-list does not exist, the file should be created and the entry added when hyrolo-add is called. Hyperbole should initialize that variable to non-null if needed as well.

@matsl
Copy link
Copy Markdown
Collaborator Author

matsl commented Apr 25, 2026

If the first file in hyrolo-file-list does not exist, the file should be created and the entry added when hyrolo-add is called. Hyperbole should initialize that variable to non-null if needed as well.

That is a good test to add and it breaks my fix. Good catch. I'll add that test and fix hyrolo-add.

Since we have a defcustom for hyrolo-file-list that initializes it, that should already be covered by that!?

But coming back to the test. What should be the behavior when adding an item to a file that does not exist but is not the first file in hyrolo-file-list? Shall it too be created or shall hyrolo-add signal an error?

Related: Do we need to check better that the first file in hyrolo-file-list is a "user-specific hyrolo file" and not just the first file that hyrolo-get-file-list returns?

@matsl matsl force-pushed the add_hyrolo_tests branch from e0ad21c to f6b13f2 Compare May 8, 2026 21:00
@matsl
Copy link
Copy Markdown
Collaborator Author

matsl commented May 8, 2026

@rswgnu Updated the test to treat adding an item to a new file as a legit operation. Added a new test for that. PTAL.

* test/hyrolo-tests.el (hyrolo-tests--add--error-cases):
(hyrolo-tests--add-item-to-new-file): Add tests.
(hyrolo-tests--add-items-at-multiple-levels):
(hyrolo-tests--add-items-interactive): Fix quotes in docstring.
@matsl matsl force-pushed the add_hyrolo_tests branch from f6b13f2 to ce13fc0 Compare May 10, 2026 16:39
@matsl matsl merged commit ba5949d into master May 10, 2026
4 checks passed
@matsl matsl deleted the add_hyrolo_tests branch May 10, 2026 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants