|
66 | 66 | (describe "when cider is connected"
|
67 | 67 | (it "uses cider-reader-conditional-face"
|
68 | 68 | (spy-on 'cider-connected-p :and-return-value t)
|
69 |
| - (spy-on 'cider-connection-type-for-buffer :and-return-value "clj") |
| 69 | + (spy-on 'cider-project-connections-types :and-return-value '("clj")) |
70 | 70 | (cider--test-with-temp-buffer "#?(:clj 'clj :cljs 'cljs :cljr 'cljr)"
|
71 | 71 | (let ((cider-font-lock-reader-conditionals t)
|
72 | 72 | (found (cider--face-exists-in-range-p (point-min) (point-max)
|
73 |
| - 'cider-reader-conditional-face))) |
| 73 | + 'cider-reader-conditional-face))) |
74 | 74 | (expect found :to-be-truthy))))
|
75 | 75 |
|
76 | 76 | (it "highlights unmatched reader conditionals"
|
77 | 77 | (spy-on 'cider-connected-p :and-return-value t)
|
78 |
| - (spy-on 'cider-connection-type-for-buffer :and-return-value "clj") |
| 78 | + (spy-on 'cider-project-connections-types :and-return-value '("clj")) |
79 | 79 | (cider--test-with-temp-buffer "#?(:clj 'clj :cljs 'cljs :cljr 'cljr)"
|
80 | 80 | (let ((cider-font-lock-reader-conditionals t))
|
81 | 81 | (expect (cider--face-exists-in-range-p 4 12 'cider-reader-conditional-face)
|
|
87 | 87 |
|
88 | 88 | (it "works with splicing"
|
89 | 89 | (spy-on 'cider-connected-p :and-return-value t)
|
90 |
| - (spy-on 'cider-connection-type-for-buffer :and-return-value "clj") |
| 90 | + (spy-on 'cider-project-connections-types :and-return-value '("clj")) |
91 | 91 | (cider--test-with-temp-buffer "[1 2 #?(:clj [3 4] :cljs [5 6] :cljr [7 8])]"
|
92 | 92 | (let ((cider-font-lock-reader-conditionals t))
|
93 | 93 | (expect (cider--face-exists-in-range-p 1 18 'cider-reader-conditional-face)
|
|
99 | 99 |
|
100 | 100 | (it "does not apply inside strings or comments"
|
101 | 101 | (spy-on 'cider-connected-p :and-return-value t)
|
102 |
| - (spy-on 'cider-connection-type-for-buffer :and-return-value "clj") |
| 102 | + (spy-on 'cider-project-connections-types :and-return-value '("clj")) |
103 | 103 | (cider--test-with-temp-buffer "\"#?(:clj 'clj :cljs 'cljs :cljr 'cljr)\" ;; #?(:clj 'clj :cljs 'cljs :cljr 'cljr)"
|
104 | 104 | (let ((cider-font-lock-reader-conditionals t))
|
105 | 105 | (expect (cider--face-exists-in-range-p (point-min) (point-max) 'cider-reader-conditional-face)
|
106 | 106 | :not :to-be-truthy))))
|
107 | 107 |
|
108 | 108 | (it "does not apply inside strings or comments"
|
109 | 109 | (spy-on 'cider-connected-p :and-return-value t)
|
110 |
| - (spy-on 'cider-connection-type-for-buffer :and-return-value "clj") |
| 110 | + (spy-on 'cider-project-connections-types :and-return-value '("clj")) |
111 | 111 | (cider--test-with-temp-buffer "\"#?(:clj 'clj :cljs 'cljs :cljr 'cljr)\" ;; #?(:clj 'clj :cljs 'cljs :cljr 'cljr)"
|
112 | 112 | (let ((cider-font-lock-reader-conditionals t))
|
113 | 113 | (expect (cider--face-exists-in-range-p (point-min) (point-max) 'cider-reader-conditional-face)
|
114 | 114 | :not :to-be-truthy))))
|
115 | 115 |
|
116 | 116 | (it "highlights all unmatched reader conditionals"
|
117 | 117 | (spy-on 'cider-connected-p :and-return-value t)
|
118 |
| - (spy-on 'cider-connection-type-for-buffer :and-return-value "clj") |
| 118 | + (spy-on 'cider-project-connections-types :and-return-value '("cljs")) |
119 | 119 | (cider--test-with-temp-buffer
|
120 | 120 | "#?(:clj 'clj :cljs 'cljs :cljr 'cljr)\n#?(:clj 'clj :cljs 'cljs :cljr 'cljr)\n"
|
121 | 121 | (let ((cider-font-lock-reader-conditionals t))
|
122 | 122 | (expect (cider--face-covers-range-p 14 24 'cider-reader-conditional-face)
|
123 |
| - :to-be-truthy) |
| 123 | + :not :to-be-truthy) |
124 | 124 | (expect (cider--face-covers-range-p 26 36 'cider-reader-conditional-face)
|
125 | 125 | :to-be-truthy)
|
126 | 126 | (expect (cider--face-covers-range-p 52 62 'cider-reader-conditional-face)
|
127 |
| - :to-be-truthy) |
| 127 | + :not :to-be-truthy) |
128 | 128 | (expect (cider--face-covers-range-p 64 74 'cider-reader-conditional-face)
|
129 | 129 | :to-be-truthy))))
|
130 | 130 |
|
131 | 131 | (it "does not highlight beyond the limits of the reader conditional group"
|
132 | 132 | (spy-on 'cider-connected-p :and-return-value t)
|
133 |
| - (spy-on 'cider-connection-type-for-buffer :and-return-value "clj") |
| 133 | + (spy-on 'cider-project-connections-types :and-return-value '("clj")) |
134 | 134 | (cider--test-with-temp-buffer
|
135 | 135 | "#?(:clj 'clj :cljs 'cljs :cljr 'cljr)\n#?(:clj 'clj :cljs 'cljs :cljr 'cljr)\n"
|
136 | 136 | (let ((cider-font-lock-reader-conditionals t))
|
|
141 | 141 | (expect (cider--face-exists-in-range-p 75 (point-max) 'cider-reader-conditional-face)
|
142 | 142 | :not :to-be-truthy)))))
|
143 | 143 |
|
| 144 | + (describe "when multiple connections are connected" |
| 145 | + (it "is disabled" |
| 146 | + (spy-on 'cider-connected-p :and-return-value nil) |
| 147 | + (spy-on 'cider-project-connections-types :and-return-value '("clj" "cljs")) |
| 148 | + (cider--test-with-temp-buffer "#?(:clj 'clj :cljs 'cljs :cljr 'cljr)" |
| 149 | + (let ((cider-font-lock-reader-conditionals t)) |
| 150 | + (expect (cider--face-exists-in-range-p (point-min) (point-max) 'cider-reader-conditional-face) |
| 151 | + :not :to-be-truthy))))) |
| 152 | + |
144 | 153 | (describe "when cider is not connected"
|
145 | 154 | (it "is disabled"
|
146 | 155 | (spy-on 'cider-connected-p :and-return-value nil)
|
147 |
| - (spy-on 'cider-connection-type-for-buffer :and-return-value "clj") |
148 | 156 | (cider--test-with-temp-buffer "#?(:clj 'clj :cljs 'cljs :cljr 'cljr)"
|
149 | 157 | (let ((cider-font-lock-reader-conditionals t))
|
150 | 158 | (expect (cider--face-exists-in-range-p (point-min) (point-max) 'cider-reader-conditional-face)
|
|
0 commit comments