summaryrefslogtreecommitdiff
path: root/tests/test-clear-blank-lines.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-05-05 09:23:58 -0500
committerCraig Jennings <c@cjennings.net>2024-05-05 09:34:19 -0500
commit4566ec69d269ecba8d9386a131b932ee5244aa8e (patch)
treefa00edae4ba8c93eee7861fa795052511d4e0f29 /tests/test-clear-blank-lines.el
parent5f19638abc20eb24511a4129df2be09e1554591c (diff)
downloaddotemacs-4566ec69d269ecba8d9386a131b932ee5244aa8e.tar.gz
dotemacs-4566ec69d269ecba8d9386a131b932ee5244aa8e.zip
enhancements, functions, tests, and misc
enhancements - move accent-company to C-` and ensure it's on for org mode - re-enable narrow-to-region - turn on network repos by default - remove setq in company's use-package custom clause - increase company delay to .7 secs - recipe templates should have visibility show all - move video recordings code to separate module - move geiser-guile to prog-lisp functions - improve cj/reformat-region-or-buffer via restriction - improvements to test-format-region - adding tests for clear-blank-lines - Add prepend-lines and replace-fraction-glyphs functions - add cj/clear-blank-lines function - create cj/load-all-tests utility function tests - add keybinding for ert-run-tests-interactively - ensure ert libraries are available to load-all-tests - remove running the tests when evaluating the buffer - fix clear-blank-lines and adding better tests misc - updated packages - adding the luddite blog to elfeed - more abbrevs
Diffstat (limited to 'tests/test-clear-blank-lines.el')
-rw-r--r--tests/test-clear-blank-lines.el47
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/test-clear-blank-lines.el b/tests/test-clear-blank-lines.el
new file mode 100644
index 00000000..2190aba0
--- /dev/null
+++ b/tests/test-clear-blank-lines.el
@@ -0,0 +1,47 @@
+;;; test-clear-blank-lines.el --- -*- lexical-binding: t; -*-
+
+;;; Commentary:
+;;
+
+;;; Code:
+
+(require 'ert)
+(add-to-list 'load-path (concat user-emacs-directory "modules"))
+(require 'custom-functions)
+
+(ert-deftest test-cj/clear-blank-lines-region ()
+ (let ((testdata "Some\n\n\n\nText")
+ (expected "Some\nText")
+ (actual))
+ (with-temp-buffer
+ (insert testdata)
+ (cj/clear-blank-lines (point-min) (point-max))
+ (setq actual (buffer-string))
+ (message "buffer is:\n'%s'" actual)
+ (should (string= actual expected)))))
+
+(ert-deftest test-cj/clear-blank-lines-region-multiple-lines ()
+ (let ((testdata "Some\n\n\n\nText")
+ (expected "Some\n\n\n\nText")
+ (midpoint)
+ (actual))
+ (with-temp-buffer
+ (insert testdata)
+ (insert "\n")
+ (setq midpoint (point))
+ (insert testdata)
+ (cj/clear-blank-lines (point-min) midpoint)
+ (setq actual (buffer-substring (- (point-max)
+ (length testdata)) (point-max)))
+ (message "buffer is:\n'%s'" (buffer-string))
+ (should (string= actual expected)))))
+
+(ert-deftest test-cj/clear-blank-lines-negative ()
+ (with-temp-buffer
+ (insert "Some\nText")
+ (cj/clear-blank-lines (point-min) (point-max))
+ (should (equal (buffer-string) "Some\nText"))))
+
+
+(provide 'test-clear-blank-lines)
+;;; test-clear-blank-lines.el ends here.