Conversation
* test/hyrolo-tests.el (hyrolo-tests--add--error-cases): New test. (hyrolo-tests--add-items-at-multiple-levels): (hyrolo-tests--add-items-interactive): Fix quotes in docstring. * hyrolo.el (hyrolo-add): Handle not existing file error case.
|
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? |
What
Add test for hyrolo-add
test/hyrolo-tests.el (hyrolo-tests--add--error-cases): New test.
(hyrolo-tests--add-items-at-multiple-levels):
(hyrolo-tests--add-items-interactive): Fix quotes in docstring.
hyrolo.el (hyrolo-add): Handle not existing file error case.
Why
More test coverage for hyrolo.
There is also a potential problem with
The file is created (or at least a buffer for it). Not sure if it is a
feature or an error. This PR views it as an error and adds a check to
hyrolo-add to signal an error if adding an item to a file that does
not exist.
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.