Skip to content

Instantly share code, notes, and snippets.

@c-garcia
Last active February 14, 2017 19:54
Show Gist options
  • Save c-garcia/8b7d5a7d7af612b68bd092c819e366f9 to your computer and use it in GitHub Desktop.
Save c-garcia/8b7d5a7d7af612b68bd092c819e366f9 to your computer and use it in GitHub Desktop.
Clojure file predicate with ert tests.
(defun clojure-file-p (file-name)
"Determines if a file-name belongs to a clojure file."
(string-match "clj[csx]?$" file-name))
(ert-deftest hola ()
(should (not (clojure-file-p "hola.cl")))
(should (not (clojure-file-p "")))
(should (not (clojure-file-p "c")))
(should (clojure-file-p "hola.clj"))
(should (clojure-file-p "hola.cljs"))
(should (clojure-file-p "hola.cljx"))
(should (clojure-file-p "src/hola.clj"))
(should (clojure-file-p "hola.cljc")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment