Add test for denote-slug-keep-only-ascii

This commit is contained in:
Protesilaos Stavrou 2024-09-03 14:02:14 +03:00
parent 1a1775acd2
commit afe2bcaafe
No known key found for this signature in database
GPG key ID: 99BD6459CD5CA3EA
2 changed files with 7 additions and 1 deletions

View file

@ -931,7 +931,7 @@ to override what this function returns."
;;;;; Sluggification functions
(defun denote-slug-keep-only-ascii (str)
"Remove all non-ASCII characters from STR.
"Remove all non-ASCII characters from STR and replace them with spaces.
This is useful as a helper function to construct
`denote-file-name-slug-functions'."
(let* ((ascii-range (seq-map

View file

@ -48,6 +48,12 @@ Concretely, replace with spaces anything that matches the
(should (equal (denote--slug-no-punct "This is !@# test")
"This is test")))
(ert-deftest denote-test--denote-slug-keep-only-ascii ()
"Test that `denote-slug-keep-only-ascii' removes non-ASCII characters."
(should (equal
(denote-slug-keep-only-ascii "There are no-ASCII characters here 😀")
"There are no-ASCII characters here ")))
(ert-deftest denote-test--denote--slug-hyphenate ()
"Test that `denote--slug-hyphenate' hyphenates the string.
Also replace multiple hyphens with a single one and remove any