|
170 | 170 | :instance (let [{:keys [expected actual]} (exercise-instance-method m)]
|
171 | 171 | (is (= expected actual))))))
|
172 | 172 |
|
173 |
| -(deftest field-shadows-method-CLJ-2899-regression |
174 |
| - (is (= "static-field" clojure.test.SwissArmy/doppelganger)) |
175 |
| - (is (= "" (clojure.test.SwissArmy/doppelganger))) ;; favor 0-arity call over unwrap static field bug |
176 |
| - (is (= "int-int" (clojure.test.SwissArmy/.doppelganger (clojure.test.SwissArmy/new) (int 1) (int 2)))) |
177 |
| - (is (= "int-int" (apply clojure.test.SwissArmy/.doppelganger (clojure.test.SwissArmy/new) (int 1) (int 2) []))) |
178 |
| - ;; Can't distinguish field vs static method in value position w/o param-tags |
179 |
| - ;; (is (= "int-int-long" (apply clojure.test.SwissArmy/doppelganger (int 1) (int 2) (long 42) []))) |
180 |
| - (is (= "" (apply ^[] clojure.test.SwissArmy/doppelganger []))) |
181 |
| - (is (= "int-int-long" (clojure.test.SwissArmy/doppelganger (int 1) (int 2) (long 42)))) |
182 |
| - (is (thrown? Exception (eval '(clojure.test.SwissArmy/idFn 42)))) |
183 |
| - (is (= #'clojure.core/identity clojure.test.SwissArmy/idFn)) |
184 |
| - (is (= #'clojure.core/identity (clojure.test.SwissArmy/idFn)))) |
| 173 | +(deftest field-overloads-method-CLJ-2899-regression |
| 174 | + (testing "overloaded in value position" |
| 175 | + (is (= "static-field" clojure.test.SwissArmy/doppelganger))) |
| 176 | + |
| 177 | + (testing "overloaded in value position, w/paramtags" |
| 178 | + (is (= "" (apply ^[] clojure.test.SwissArmy/doppelganger [])))) |
| 179 | + |
| 180 | + (testing "overloaded, invoke no args" |
| 181 | + (is (= "" (clojure.test.SwissArmy/doppelganger)))) |
| 182 | + |
| 183 | + (testing "overloaded, invoke w/args" |
| 184 | + (is (= "int-int-long" (clojure.test.SwissArmy/doppelganger (int 1) (int 2) (long 42))))) |
| 185 | + |
| 186 | + (tesing "non-overloaded, field holds IFn, invoke w/args fails" |
| 187 | + (is (thrown? Exception (eval '(clojure.test.SwissArmy/idFn 42)))) |
| 188 | + (is (= #'clojure.core/identity clojure.test.SwissArmy/idFn))) |
| 189 | + |
| 190 | + (testing "non-overloaded, field holds IFn, invoke no args" |
| 191 | + (is (= #'clojure.core/identity (clojure.test.SwissArmy/idFn)))) |
| 192 | + |
| 193 | + (testing "instance method overloads" |
| 194 | + (is (= "int-int" (clojure.test.SwissArmy/.doppelganger (clojure.test.SwissArmy/new) (int 1) (int 2)))) |
| 195 | + (is (= "int-int" (apply clojure.test.SwissArmy/.doppelganger (clojure.test.SwissArmy/new) (int 1) (int 2) []))))) |
185 | 196 |
|
186 | 197 | (defmacro arg-tags-called-in-macro
|
187 | 198 | [a-type b-type a b]
|
|
0 commit comments