Replace space with dash for function name

This commit is contained in:
Willem van den Ende
2023-01-12 22:14:50 +00:00
parent 91d17742ff
commit 0a46429a16
+8 -1
View File
@@ -358,11 +358,18 @@ the description. This may destroy existing links, or change their targets so use
(message "Renamed %s to %s." old-name new-name))) (message "Renamed %s to %s." old-name new-name)))
(message "No symbol under cursor.")))) (message "No symbol under cursor."))))
;; tests are better than literate programming when you want to triangulate on the same function
;; org only shows the last return value by default, you can return a list of course, but still
(defun as-function-name (candidate-name) (defun as-function-name (candidate-name)
candidate-name) "Take the string and make it suitable to be a function name"
(declare (side-effect-free t))
(candidate-name)
(ert-deftest refactor-rename-should-leave-forward-slash() (ert-deftest refactor-rename-should-leave-forward-slash()
(should (equal (as-function-name "qwan/echo") (should (equal (as-function-name "qwan/echo")
"qwan/echo"))) "qwan/echo")))
(ert-deftest refactor-rename-should-replace-space-with-dash()
(should (equal (as-function-name "qwan/echo chamber")
"qwan/echo-chamber")))
(ert "refactor.*") (ert "refactor.*")