From d1566dd0e64befd79e5db149456032dfb5a0c505 Mon Sep 17 00:00:00 2001 From: William Carroll Date: Sun, 22 Dec 2019 21:33:48 +0000 Subject: Refactor strings.el tests Ensure that string.el follows the latest whim in my Elisp testing circus. --- configs/shared/.emacs.d/wpc/string.el | 41 +++++++++++++++-------------------- 1 file changed, 18 insertions(+), 23 deletions(-) (limited to 'configs/shared/.emacs.d/wpc/string.el') diff --git a/configs/shared/.emacs.d/wpc/string.el b/configs/shared/.emacs.d/wpc/string.el index 56c9279dd5b9..9ffe84572af5 100644 --- a/configs/shared/.emacs.d/wpc/string.el +++ b/configs/shared/.emacs.d/wpc/string.el @@ -12,11 +12,16 @@ (require 's) (require 'dash) +;; TODO: Resolve the circular dependency that this introduces. +;; (require 'prelude) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Library ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defconst string/test? t + "When t, run the tests.") + ;; Strings (defun string/hookify (x) "Append \"-hook\" to X." @@ -98,29 +103,19 @@ ;; Tests ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; TODO: Support these. -;; (require 'macros) -;; (macros/test -;; :function string/surround -;; :test "works as expected" -;; :args '("-*-" "surround") -;; :expect "-*-surround-*-" -;; :equality string=) -; -;; (macros/test -;; :function string/caps->kebab -;; :test "works as expected" -;; :args '("CAPS_CASE_STRING") -;; :expect "caps-case-string" -;; :equality string=) -; -;; ;; TODO: Generate :test from docs of defun. -;; (macros/test -;; :function string/kebab->caps -;; :test "works as expected" -;; :args '("kebab-case-string") -;; :expect "KEBAB_CASE_STRING" -;; :equality =) +;; (when string/test? +;; (prelude/assert +;; (string= +;; (string/surround "-*-" "surround") +;; "-*-surround-*-")) +;; (prelude/assert +;; (string= +;; (string/caps->kebab "CAPS_CASE_STRING") +;; "caps-case-string")) +;; (prelude/assert +;; (string= +;; (string/kebab->caps "kebab-case-string") +;; "KEBAB_CASE_STRING"))) (provide 'string) ;;; string.el ends here -- cgit 1.4.1