diff options
| author | Craig Jennings <c@cjennings.net> | 2025-11-13 13:16:44 -0600 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2025-11-13 13:16:44 -0600 |
| commit | a064c5d7659d84393fd8f586bb1c7d18a5436b38 (patch) | |
| tree | 58ce7ac137226bc6f40a2a359b138ee58cbb33db /tests/test-org-drill-entry-p.el | |
| parent | c4c64e2762d7b75f588c20bc7d43ddf8ba30c97e (diff) | |
| download | org-drill-a064c5d7659d84393fd8f586bb1c7d18a5436b38.tar.gz org-drill-a064c5d7659d84393fd8f586bb1c7d18a5436b38.zip | |
test: Add boundary, error, and edge case tests
Added 66 comprehensive tests covering:
- Entry detection with extreme values and Unicode
- SM2 algorithm with boundary conditions
- Workflow error handling with malformed data
- Card types with complex content structures
Diffstat (limited to 'tests/test-org-drill-entry-p.el')
| -rw-r--r-- | tests/test-org-drill-entry-p.el | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/tests/test-org-drill-entry-p.el b/tests/test-org-drill-entry-p.el index c298c94..4af9169 100644 --- a/tests/test-org-drill-entry-p.el +++ b/tests/test-org-drill-entry-p.el @@ -178,5 +178,91 @@ Single asterisk should still work as heading." (lambda () (should (org-drill-entry-p))))) +;;; Aggressive Boundary Cases + +(ert-deftest test-org-drill-entry-p-boundary-very-long-tag-name () + "Test drill tag with very long name (edge case). +Tag name length should not cause issues." + (let* ((long-tag (make-string 200 ?d)) + (content (format "* Heading :%s:\n\nContent\n" long-tag))) + (test-org-drill-entry-p--with-org-buffer + content + (lambda () + ;; Should not match 'drill' tag + (should-not (org-drill-entry-p)))))) + +(ert-deftest test-org-drill-entry-p-boundary-many-tags () + "Test heading with many tags including drill. +Should still correctly identify drill tag among many others." + (let ((content "* Heading :tag1:tag2:tag3:drill:tag4:tag5:tag6:tag7:tag8:tag9:tag10:\n\nContent\n")) + (test-org-drill-entry-p--with-org-buffer + content + (lambda () + (should (org-drill-entry-p)))))) + +(ert-deftest test-org-drill-entry-p-boundary-unicode-in-heading () + "Test heading with unicode characters and drill tag. +Unicode should not interfere with tag detection." + (let ((content "* Café München 北京 :drill:\n\nUnicode content 日本語\n")) + (test-org-drill-entry-p--with-org-buffer + content + (lambda () + (should (org-drill-entry-p)))))) + +(ert-deftest test-org-drill-entry-p-boundary-deep-nesting () + "Test drill tag detection at deep nesting level. +Should work at any heading level." + (let ((content "* Level 1\n** Level 2\n*** Level 3\n**** Level 4\n***** Level 5 :drill:\n\nDeep content\n")) + (test-org-drill-entry-p--with-org-buffer + content + (lambda () + ;; Navigate to deeply nested heading + (re-search-forward "Level 5") + (beginning-of-line) + (should (org-drill-entry-p)))))) + +(ert-deftest test-org-drill-entry-p-boundary-tag-with-numbers () + "Test that tags containing 'drill' substring but with numbers don't match. +drill123 should not be recognized as drill tag." + (let ((content "* Heading :drill123:\n\nContent\n")) + (test-org-drill-entry-p--with-org-buffer + content + (lambda () + (should-not (org-drill-entry-p)))))) + +(ert-deftest test-org-drill-entry-p-boundary-drill-at-tag-boundary () + "Test drill tag at beginning and end of tag list." + (let ((content1 "* Heading :drill:other:tags:\n\nContent\n") + (content2 "* Heading :other:tags:drill:\n\nContent\n")) + ;; drill at start + (test-org-drill-entry-p--with-org-buffer + content1 + (lambda () + (should (org-drill-entry-p)))) + ;; drill at end + (test-org-drill-entry-p--with-org-buffer + content2 + (lambda () + (should (org-drill-entry-p)))))) + +(ert-deftest test-org-drill-entry-p-boundary-special-chars-in-heading () + "Test heading with special characters and drill tag. +Special chars should not break tag parsing." + (let ((content "* Heading with @#$%^&*() special chars :drill:\n\nContent\n")) + (test-org-drill-entry-p--with-org-buffer + content + (lambda () + (should (org-drill-entry-p)))))) + +(ert-deftest test-org-drill-entry-p-boundary-very-long-heading-line () + "Test heading with very long title text. +Long heading should not affect tag detection." + (let* ((long-title (make-string 1000 ?x)) + (content (format "* %s :drill:\n\nContent\n" long-title))) + (test-org-drill-entry-p--with-org-buffer + content + (lambda () + (should (org-drill-entry-p)))))) + (provide 'test-org-drill-entry-p) ;;; test-org-drill-entry-p.el ends here |
