Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Import memfn macro and add tests

  • Loading branch information...
commit 8965df74d424ed41beb3990a55d775d2d851aacd 1 parent 8072643
@brandonbloom brandonbloom authored David Nolen committed
Showing with 3 additions and 1 deletion.
  1. +1 −1  src/clj/cljs/core.clj
  2. +2 −0  test/cljs/cljs/core_test.cljs
View
2  src/clj/cljs/core.clj
@@ -40,7 +40,7 @@
doto
extend-protocol fn for
if-let if-not let letfn loop
- or
+ memfn or
when when-first when-let when-not while])
(def fast-path-protocols
View
2  test/cljs/cljs/core_test.cljs
@@ -1291,12 +1291,14 @@
(assert (= 3 (. "abc" -length)))
(assert (= "bc" (.substring s 1)))
(assert (= "bc" (.substring "abc" 1)))
+ (assert (= "bc" ((memfn substring start) s 1)))
(assert (= "bc" (. s substring 1)))
(assert (= "bc" (. s (substring 1))))
(assert (= "bc" (. s (substring 1 3))))
(assert (= "bc" (.substring s 1 3)))
(assert (= "ABC" (. s (toUpperCase))))
(assert (= "ABC" (. "abc" (toUpperCase))))
+ (assert (= "ABC" ((memfn toUpperCase) s)))
(assert (= "BC" (. (. s (toUpperCase)) substring 1)))
(assert (= 2 (.-length (. (. s (toUpperCase)) substring 1)))))
Please sign in to comment.
Something went wrong with that request. Please try again.