Commit c7c223a 1 parent 31acbf0 commit c7c223a Copy full SHA for c7c223a
File tree 2 files changed +36
-3
lines changed
2 files changed +36
-3
lines changed Original file line number Diff line number Diff line change 62
62
`(do ~@(map (fn [[type & meths]]
63
63
`(do
64
64
~@(map (fn [meth]
65
- `(defmethod ~(fq-meth-name (str (first meth)))
65
+ `(defmethod ~(fq-meth-name (name (first meth)))
66
66
~type
67
67
~(second meth) ~@(nnext meth)))
68
68
meths)))
101
101
fq-meth-name #(symbol pns %)]
102
102
`(do
103
103
~@(map (fn [meth]
104
- `(defmethod ~(fq-meth-name (str (first meth)))
104
+ `(defmethod ~(fq-meth-name (name (first meth)))
105
105
~type ~(second meth) ~@(nnext meth)))
106
106
meths)))) proto+meths))))
107
107
Original file line number Diff line number Diff line change 91
91
(str/replace " String" " js/String" )))]
92
92
(is (true ? (tu/eval* prog #?(:clj {}
93
93
:cljs {:classes {:allow :all
94
- 'js #js {:String js/String}}}))))))
94
+ 'js #js {:String js/String}}})))))
95
+ (testing " Aliases are allowed and ignored"
96
+ (let [prog "
97
+ (ns foo) (defprotocol Foo (foo [this]))
98
+ (ns bar (:require [foo :as f]))
99
+
100
+ (extend-type String
101
+ f/Foo
102
+ (f/foo [this] (subs this 0 1)))
103
+
104
+ (= \" f\" (f/foo \" foo\" ))
105
+ "
106
+ prog #?(:clj prog
107
+ :cljs (-> prog
108
+ (str/replace " String" " js/String" )))]
109
+ (is (true ? (tu/eval* prog #?(:clj {}
110
+ :cljs {:classes {:allow :all
111
+ 'js #js {:String js/String}}})))))
112
+ (let [prog "
113
+ (ns foo) (defprotocol Foo (foo [this]))
114
+ (ns bar (:require [foo :as f]))
115
+
116
+ (extend-protocol f/Foo
117
+ String
118
+ (f/foo [this] (subs this 0 1)))
119
+
120
+ (= \" f\" (f/foo \" foo\" ))
121
+ "
122
+ prog #?(:clj prog
123
+ :cljs (-> prog
124
+ (str/replace " String" " js/String" )))]
125
+ (is (true ? (tu/eval* prog #?(:clj {}
126
+ :cljs {:classes {:allow :all
127
+ 'js #js {:String js/String}}})))))))
95
128
96
129
(deftest extend-via-metadata-test
97
130
(let [prog "
You can’t perform that action at this time.
0 commit comments