Back
->PascalCase (clj)
(source)declaration
Examples
camel-snake-kebab
(ns camel-snake-kebab.core-test
(:require [camel-snake-kebab.core :as csk]
#?(:clj [clojure.test :refer :all]
:cljs [cljs.test :refer-macros [deftest testing is are]]))
#?(:clj (:import (clojure.lang ExceptionInfo))))
(testing "rejection of namespaced keywords and symbols"
(is (thrown? ExceptionInfo (csk/->PascalCase (keyword "a" "b"))))
(is (thrown? ExceptionInfo (csk/->PascalCase (symbol "a" "b")))))
(testing "all the type preserving functions"
(let
[inputs ["FooBar"
"fooBar"
"FOO_BAR"
"foo_bar"
"foo-bar"
"Foo_Bar"]
functions [csk/->PascalCase
csk/->camelCase
csk/->SCREAMING_SNAKE_CASE
csk/->snake_case
csk/->kebab-case
csk/->Camel_Snake_Case]
formats [identity keyword symbol]]
(testing "some of the type converting functions"
(are [x y] (= x y)
:FooBar (csk/->PascalCaseKeyword 'foo-bar)
"FOO_BAR" (csk/->SCREAMING_SNAKE_CASE_STRING :foo-bar)
'foo-bar (csk/->kebab-case-symbol "foo bar")))