diff options
| author | Craig Jennings <c@cjennings.net> | 2025-10-26 20:50:53 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2025-10-26 20:50:53 -0500 |
| commit | caecfc47339c8f6ad0439d0851168655725ae8d8 (patch) | |
| tree | 2b55cc2833a08abbcff7636bbb2672a7c7a09fb1 /tests/test-fixup-whitespace.el.disabled | |
| parent | 1066d0410660d1820064c757abe7b5aad6e6070f (diff) | |
test:removing old (now redundant) tests
Diffstat (limited to 'tests/test-fixup-whitespace.el.disabled')
| -rw-r--r-- | tests/test-fixup-whitespace.el.disabled | 159 |
1 files changed, 0 insertions, 159 deletions
diff --git a/tests/test-fixup-whitespace.el.disabled b/tests/test-fixup-whitespace.el.disabled deleted file mode 100644 index 0126801a..00000000 --- a/tests/test-fixup-whitespace.el.disabled +++ /dev/null @@ -1,159 +0,0 @@ -;;; test-fixup-whitespace.el --- -*- lexical-binding: t; -*- - -;;; Commentary: -;; Test cj/fixup-whitespace-line-or-region in custom-functions.el - -;; The function under test should: -;; - ensure there is exactly one space between words -;; - remove tab characters -;; - remove leading and trailing whitespace -;; - operate on a line, or a region, if selected - -;;; Code: - - -(require 'ert) -(add-to-list 'load-path (concat user-emacs-directory "modules")) -(require 'custom-functions) - -(ert-deftest test-cj/fixup-whitespace-positive-first-line-only () - "Test a positive case with two lines. -Both lines have whitespace at the beginning and the end. This tests that when -this function is called on the first line, only that line is affected." - (let ((testdata " Hello, world! \n Foo bar ") - (expected "Hello, world!\n Foo bar ") - (actual)) - (with-temp-buffer - (insert testdata) - (goto-char (point-min)) - (cj/fixup-whitespace-line-or-region) - (setq actual (buffer-string)) - (should (string= actual expected))))) - -(ert-deftest test-cj/fixup-whitespace-positive-first-line-only-tabs () - "Test a positive case with two lines. -Both lines have extraneous whitespace at the beginning and the end, includuing -tabs. This tests that when this function is called on the first line, only that -line is affected." - (let ((testdata " Hello,\t world! \n Foo\tbar ") - (expected "Hello, world!\n Foo\tbar ") - (actual)) - (with-temp-buffer - (insert testdata) - (goto-char (point-min)) - (cj/fixup-whitespace-line-or-region) - (setq actual (buffer-string)) - (should (string= actual expected))))) - -(ert-deftest test-cj/fixup-whitespace-positive-first-line-only-tabs2 () - "Test a positive case with two lines. -Both lines have extraneous whitespace at the beginning and the end, includuing -tabs. This tests that when this function is called on the first line, only that -line is affected." - (let ((testdata "\t Hello,\tworld! \n Foo\t bar\t ") - (expected "Hello, world!\n Foo\t bar\t ") - (actual)) - (with-temp-buffer - (insert testdata) - (goto-char (point-min)) - (cj/fixup-whitespace-line-or-region) - (setq actual (buffer-string)) - (should (string= actual expected))))) - -(ert-deftest test-cj/fixup-whitespace-negative-first-line-only () - "Test a negative case with two lines. -Only the second line has whitespace at the beginning and the end. This tests -that when this function is called on the first line, neither line changes." - (let ((testdata "Hello, world!\n Foo bar ") - (expected "Hello, world!\n Foo bar ") - (actual)) - (with-temp-buffer - (insert testdata) - (goto-char (point-min)) - (cj/fixup-whitespace-line-or-region) - (setq actual (buffer-string)) - (should (string= actual expected))))) - -(ert-deftest test-cj/fixup-whitespace-positive-second-line-only () - "Test a positive case with two lines. -Both lines have whitespace at the beginning and the end. This tests that when -function is called on the second line, only that line is affected." - (let ((testdata " Hello, world! \n Foo bar ") - (expected " Hello, world! \nFoo bar") - (actual)) - (with-temp-buffer - (insert testdata) - (goto-char (point-min)) - (forward-line) - (cj/fixup-whitespace-line-or-region) - (setq actual (buffer-string)) - (should (string= actual expected))))) - -(ert-deftest test-cj/fixup-whitespace-negative-second-line-only () - "Test a negative case with two lines. -Only the first line has whitespace at the beginning and the end. This tests -that when this function is called on the first line, neither line changes." - (let ((testdata " Hello, world! \nFoo bar") - (expected " Hello, world! \nFoo bar") - (actual)) - (with-temp-buffer - (insert testdata) - (goto-char (point-min)) - (forward-line) - (cj/fixup-whitespace-line-or-region) - (setq actual (buffer-string)) - (should (string= actual expected))))) - -(ert-deftest test-cj/fixup-whitespace-positive-region () - "Test a positive case with a region. -Two lines have whitespace at the beginning, the middle, and the end. This tests -that when this function is called with a region, all whitespace is cleaned up as -expected." - (let ((testdata " Hello, world! \n Foo bar ") - (expected "Hello, world!\nFoo bar") - (actual)) - (with-temp-buffer - (insert testdata) - (goto-char (point-min)) - (set-mark (point)) - (goto-char (point-max)) - (cj/fixup-whitespace-line-or-region t) - (setq actual (buffer-string)) - (should (string= actual expected))))) - -(ert-deftest test-cj/fixup-whitespace-positive-region-tabs () - "Test a positive case with a region and tabs. -Two lines have extraneous whitespace at the beginning, the middle, and the end. -This tests that when this function is called with a region, all whitespace is -cleaned up as expected." - (let ((testdata " \t \t Hello, world! \n Foo\t bar ") - (expected "Hello, world!\nFoo bar") - (actual)) - (with-temp-buffer - (insert testdata) - (goto-char (point-min)) - (set-mark (point)) - (goto-char (point-max)) - (cj/fixup-whitespace-line-or-region t) - (setq actual (buffer-string)) - (should (string= actual expected))))) - -(ert-deftest test-cj/fixup-whitespace-negative-region () - "Test a negative case with a region. -Two lines are inserted, neither of which have extraneous whitespace. This tests -that when this function is called with a region, there's no unwanted -side-effects and nothing changes." - (let ((testdata "Hello, world!\nFoo bar") - (expected "Hello, world!\nFoo bar") - (actual)) - (with-temp-buffer - (insert testdata) - (goto-char (point-min)) - (set-mark (point)) - (goto-char (point-max)) - (cj/fixup-whitespace-line-or-region t) - (setq actual (buffer-string)) - (should (string= actual expected))))) - -(provide 'test-fixup-whitespace) -;;; test-fixup-whitespace.el ends here. |
