Allow user to specify own escape-chars
[frak.git] / test / frak_test.clj
index c0bf8e5c33a9bf451b656c1a7ab79611346e74e7..23a0f4116dca78bc1a4a1c09a4cb977fd47edbd9 100644 (file)
   (is (= "foo\\??"
          (string-pattern ["foo" "foo?"])))
 
+  (is (= "\\!\\\"\\#\\%\\&\\'\\,\\-\\/\\:\\;\\<\\=\\>\\@\\`\\~"
+         (string-pattern ["!\"#%&',-/:;<=>@`~"] {:escape-chars :vim})))
+
+  (is (= "foo\\★?"
+         (string-pattern ["foo" "foo★"] {:escape-chars #{\★}})))
+
   (are [words] (every? #(re-matches (pattern words) %) words)
     ["achy" "achylia" "achylous" "achymia" "achymous"]
     ["aching" "achingly"]))