Skip to content

Commit

Permalink
Added tests for this, including use of self-call
Browse files Browse the repository at this point in the history
  • Loading branch information
fogus committed Sep 16, 2011
1 parent ae054a5 commit 9b15ff4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/cljs/cljs/core_test.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -724,5 +724,16 @@
(assert (= (assoc fred :lastname "Flintstone") {:firstname "Fred" :lastname "Flintstone"}))
(assert (= (assoc fred :wife :ethel) {:firstname "Fred" :lastname "Mertz" :wife :ethel}))
(assert (= (dissoc ethel :husband) {:firstname "Ethel" :lastname "Mertz"}))

;; extend-object
(let [obj (js* "{}")]
(extend-object obj
{:foo #(do 42)
:bar #(+ 100 (. js/this (foo)))
:baz #(+ % %2)})

(assert (= 42 (. obj (foo))))
(assert (= 142 (. obj (bar))))
(assert (= 3 (. obj baz 1 2))))

:ok)

0 comments on commit 9b15ff4

Please sign in to comment.