From 4566ec69d269ecba8d9386a131b932ee5244aa8e Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 5 May 2024 09:23:58 -0500 Subject: 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 --- tests/test-clear-blank-lines.el | 47 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 tests/test-clear-blank-lines.el (limited to 'tests/test-clear-blank-lines.el') 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. -- cgit v1.2.3