Replace space with dash for function name
This commit is contained in:
@@ -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.*")
|
||||||
|
|||||||
Reference in New Issue
Block a user