Skip to content

add kotl mode add cell tests#767

Merged
matsl merged 7 commits into
masterfrom
add_kotl-mode_add-cell_tests
Aug 4, 2025
Merged

add kotl mode add cell tests#767
matsl merged 7 commits into
masterfrom
add_kotl-mode_add-cell_tests

Conversation

@matsl
Copy link
Copy Markdown
Collaborator

@matsl matsl commented Jul 29, 2025

What

Add:

  • kotl-mode--add-cell
  • kotl-mode--add-after-parent
  • kotl-mode--add-before-parent
  • kotl-mode--add-below-parent
  • kotl-mode--add-child

Why

Functions are lacking tests.

Note

Using a temp buffer

These tests uses a new way of testing kotl-mode by combining erase-buffer
and cl-flet with with-temp-buffer. A local function is used that erases the
buffer and then calls kotl-mode which initializes the buffer. That way one
temp buffer can be used over and over again with greater speed and less
file creation and deletion.

If there are no problems with using a temp buffer with kotl-mode
then I think that can be applied for more of the kotl-mode tests and
maybe even for more of our tests.

@matsl matsl requested a review from rswgnu July 29, 2025 14:43
@rswgnu
Copy link
Copy Markdown
Owner

rswgnu commented Jul 29, 2025 via email

@rswgnu
Copy link
Copy Markdown
Owner

rswgnu commented Jul 29, 2025 via email

@matsl
Copy link
Copy Markdown
Collaborator Author

matsl commented Jul 31, 2025

Please rewrite the Note and code if need be with the info I just provided and then I’ll review it. Thanks.

I have removed the comment from the "Note section" above about the behavior of the function kotl-mode--add-cell. Leaving that for a separate discussion outside of this PR. I'm also adding test cases for the remaning kotl-mode:add* functions.

There is one issue in kotl-mode:add-before-parent. It is documented in comments in the test case.

Comment thread test/kotl-mode-tests.el
Comment on lines +1256 to +1257
;; (should (kotl-mode:first-cell-p))) ;; <= EXPECTED
(should (string= (kcell-view:label (point)) "2"))) ;; FAIL: Actual.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cell should be added at the start of the outline. i.e. label=1 but is added after i.e. label=2.

@matsl matsl merged commit def2481 into master Aug 4, 2025
4 checks passed
@matsl matsl deleted the add_kotl-mode_add-cell_tests branch August 4, 2025 15:30
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