@@ -776,24 +776,51 @@ DESCRIPTION is the description of the spec."
776
776
(6 42 clojure-keyword-face)))
777
777
778
778
(when-fontifying-it " should handle namespaced defs"
779
- (" (_c4/defconstrainedfn bar [] nil)"
779
+ (" (_c4/defn bar [] nil)"
780
780
(2 4 font-lock-type-face )
781
781
(5 5 nil )
782
- (6 18 font-lock-keyword-face )
783
- (23 25 font-lock-function-name-face ))
782
+ (6 9 font-lock-keyword-face )
783
+ (11 13 font-lock-function-name-face ))
784
784
785
- (" (clo/defbar foo nil)"
785
+ (" (clo/defrecord foo nil)"
786
786
(2 4 font-lock-type-face )
787
787
(5 5 nil )
788
- (6 11 font-lock-keyword-face )
789
- (13 15 font-lock-function-name-face ))
788
+ (6 14 font-lock-keyword-face )
789
+ (16 18 font-lock-function-name-face ))
790
790
791
791
(" (s/def ::keyword)"
792
792
(2 2 font-lock-type-face )
793
793
(3 3 nil )
794
794
(4 6 font-lock-keyword-face )
795
795
(8 16 clojure-keyword-face)))
796
796
797
+ (when-fontifying-it " should handle any known def form"
798
+ (" (def a 1)" (2 4 font-lock-keyword-face ))
799
+ (" (defonce a 1)" (2 8 font-lock-keyword-face ))
800
+ (" (defn a [b])" (2 5 font-lock-keyword-face ))
801
+ (" (defmacro a [b])" (2 9 font-lock-keyword-face ))
802
+ (" (definline a [b])" (2 10 font-lock-keyword-face ))
803
+ (" (defmulti a identity)" (2 9 font-lock-keyword-face ))
804
+ (" (defmethod a :foo [b] (println \" bar\" ))" (2 10 font-lock-keyword-face ))
805
+ (" (defprotocol a (b [this] \" that\" ))" (2 12 font-lock-keyword-face ))
806
+ (" (definterface a (b [c]))" (2 13 font-lock-keyword-face ))
807
+ (" (defrecord a [b c])" (2 10 font-lock-keyword-face ))
808
+ (" (deftype a [b c])" (2 8 font-lock-keyword-face ))
809
+ (" (defstruct a :b :c)" (2 10 font-lock-keyword-face ))
810
+ (" (deftest a (is (= 1 1)))" (2 8 font-lock-keyword-face ))
811
+ (" (defne [x y])" (2 6 font-lock-keyword-face ))
812
+ (" (defnm a b)" (2 6 font-lock-keyword-face ))
813
+ (" (defnu)" (2 6 font-lock-keyword-face ))
814
+ (" (defnc [a])" (2 6 font-lock-keyword-face ))
815
+ (" (defna)" (2 6 font-lock-keyword-face ))
816
+ (" (deftask a)" (2 8 font-lock-keyword-face ))
817
+ (" (defstate a :start \" b\" :stop \" c\" )" (2 9 font-lock-keyword-face )))
818
+
819
+ (when-fontifying-it " should ignore unknown def forms"
820
+ (" (defbugproducer me)" (2 15 nil ))
821
+ (" (default-user-settings {:a 1})" (2 24 nil ))
822
+ (" (s/deftartar :foo)" (4 10 nil )))
823
+
797
824
(when-fontifying-it " should handle variables defined with def"
798
825
(" (def foo 10)"
799
826
(2 4 font-lock-keyword-face )
@@ -845,23 +872,6 @@ DESCRIPTION is the description of the spec."
845
872
(2 5 font-lock-keyword-face )
846
873
(7 9 font-lock-function-name-face )))
847
874
848
- (when-fontifying-it " should handle a custom def with special chars 1"
849
- (" (defn* foo [x] x)"
850
- (2 6 font-lock-keyword-face )
851
- (8 10 font-lock-function-name-face )))
852
-
853
- (when-fontifying-it " should handle a custom def with special chars 2"
854
- (" (defsomething! foo [x] x)"
855
- (2 14 font-lock-keyword-face )
856
- (16 18 font-lock-function-name-face )))
857
-
858
- (when-fontifying-it " should handle a custom def with special chars 3"
859
- (" (def-something foo [x] x)"
860
- (2 14 font-lock-keyword-face ))
861
-
862
- (" (def-something foo [x] x)"
863
- (16 18 font-lock-function-name-face )))
864
-
865
875
(when-fontifying-it " should handle fn"
866
876
; ; try to byte-recompile the clojure-mode.el when the face of 'fn' is 't'
867
877
(" (fn foo [x] x)"
0 commit comments