|
834 | 834 | (call-interactively #'clojure-align) |
835 | 835 | (expect (string= (buffer-string) "{:a 2, :c 4}"))))) |
836 | 836 |
|
| 837 | +(describe "clojure--valid-indent-spec-p" |
| 838 | + (it "should accept integers" |
| 839 | + (expect (clojure--valid-indent-spec-p '1) :to-be-truthy)) |
| 840 | + |
| 841 | + (it "should accept :defn and :form keywords" |
| 842 | + (expect (clojure--valid-indent-spec-p ':defn) :to-be-truthy) |
| 843 | + (expect (clojure--valid-indent-spec-p ':form) :to-be-truthy)) |
| 844 | + |
| 845 | + (it "should accept quoted list specs" |
| 846 | + (expect (clojure--valid-indent-spec-p '(quote (2 :form :form (1)))) :to-be-truthy)) |
| 847 | + |
| 848 | + (it "should accept nested specs like letfn's ((:defn))" |
| 849 | + (expect (clojure--valid-indent-spec-p '(quote (1 ((:defn)) nil))) :to-be-truthy)) |
| 850 | + |
| 851 | + (it "should accept nil as a valid spec element" |
| 852 | + (expect (clojure--valid-indent-spec-p '(quote (1))) :to-be-truthy) |
| 853 | + (expect (clojure--valid-indent-spec-p '(quote (:defn))) :to-be-truthy))) |
| 854 | + |
| 855 | +(describe "clojure--valid-put-clojure-indent-call-p" |
| 856 | + (it "should accept letfn-style indent spec" |
| 857 | + (expect (clojure--valid-put-clojure-indent-call-p |
| 858 | + '(put-clojure-indent 'letfn '(1 ((:defn)) nil))) |
| 859 | + :to-be-truthy)) |
| 860 | + |
| 861 | + (it "should accept simple indent specs" |
| 862 | + (expect (clojure--valid-put-clojure-indent-call-p |
| 863 | + '(put-clojure-indent 'defrecord '(2 :form :form (1)))) |
| 864 | + :to-be-truthy)) |
| 865 | + |
| 866 | + (it "should accept keyword indent specs" |
| 867 | + (expect (clojure--valid-put-clojure-indent-call-p |
| 868 | + '(put-clojure-indent 'fn :defn)) |
| 869 | + :to-be-truthy)) |
| 870 | + |
| 871 | + (it "should reject invalid specs" |
| 872 | + (expect (clojure--valid-put-clojure-indent-call-p |
| 873 | + '(put-clojure-indent 'foo "bar")) |
| 874 | + :to-throw))) |
| 875 | + |
837 | 876 | (provide 'clojure-mode-indentation-test) |
838 | 877 |
|
839 | 878 | ;;; clojure-mode-indentation-test.el ends here |
0 commit comments