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-title-case-region.el | 44 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 tests/test-title-case-region.el (limited to 'tests/test-title-case-region.el') diff --git a/tests/test-title-case-region.el b/tests/test-title-case-region.el new file mode 100644 index 00000000..ffab0c24 --- /dev/null +++ b/tests/test-title-case-region.el @@ -0,0 +1,44 @@ +;;; test-title-case-region.el --- -*- lexical-binding: t; -*- + +;;; Commentary: +;; Tests for the title-case region function in custom-functions.el + +;; Note on Title Case +;; Title case is a capitalization convention where major words are +;; capitalized,and most minor words are lowercase. Nouns,verbs (including +;; linking verbs), adjectives, adverbs,pronouns,and all words of four letters or +;; more are considered major words. Short (i.e., three letters or fewer) +;; conjunctions, short prepositions,and all articles are considered minor +;; words." + +;; positive case (single line, all lowercase, no skip words) +;; positive case (six lines, mixed case, skip words) +;; negative case (single line, all skip-words) +;; negative case (a long empty string) + + +;;; 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))))) + + + + +(provide 'test-title-case-region) +;;; test-title-case-region.el ends here. -- cgit v1.2.3