Skip to content

Commit 149d182

Browse files
committed
add proxy tests to main test runner and lite mode runner
1 parent f6abdc8 commit 149d182

File tree

3 files changed

+40
-3
lines changed

3 files changed

+40
-3
lines changed

src/test/cljs/cljs/proxy_test.cljs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
; Copyright (c) Rich Hickey. All rights reserved.
2+
; The use and distribution terms for this software are covered by the
3+
; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
4+
; which can be found in the file epl-v10.html at the root of this distribution.
5+
; By using this software in any fashion, you are agreeing to be bound by
6+
; the terms of this license.
7+
; You must not remove this notice, or any other, from this software.
8+
9+
(ns cljs.proxy-test
10+
(:refer-global :only [Object])
11+
(:require [cljs.test :as test :refer-macros [deftest testing is are]]
12+
[cljs.proxy :refer [builder]]
13+
[goog.object :as gobj]))
14+
15+
(def proxy (builder))
16+
17+
(deftest map-proxy
18+
(let [proxied (proxy {:foo 1 :bar 2})]
19+
(is (== 1 (gobj/get proxied "foo")))
20+
(is (== 2 (gobj/get proxied "bar")))
21+
(is (= ["foo" "bar"] (seq (Object/keys proxied))))))
22+
23+
(deftest vector-proxy
24+
(let [proxied (proxy [1 2 3 4])]
25+
(is (== 4 (alength proxied)))
26+
(is (== 1 (aget proxied 0)))
27+
(is (== 4 (aget proxied 3)))))
28+
29+
(comment
30+
31+
(test/run-tests)
32+
33+
)

src/test/cljs/lite_test_runner.cljs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@
6262
[cljs.repl-test]
6363
[cljs.lite-collections-test]
6464
[cljs.extend-to-native-test]
65-
[cljs.var-test]))
65+
[cljs.var-test]
66+
[cljs.proxy-test]))
6667

6768
(set! *print-newline* false)
6869

@@ -124,4 +125,5 @@
124125
'cljs.lite-collections-test
125126
'cljs.extend-to-native-test
126127
'cljs.var-test
128+
'cljs.proxy-test
127129
)

src/test/cljs/test_runner.cljs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@
6161
[cljs.walk-test]
6262
[cljs.repl-test]
6363
[cljs.extend-to-native-test]
64-
[cljs.var-test]))
64+
[cljs.var-test]
65+
[cljs.proxy-test]))
6566

6667
(set! *print-newline* false)
6768

@@ -124,4 +125,5 @@
124125
'cljs.walk-test
125126
'cljs.repl-test
126127
'cljs.extend-to-native-test
127-
'cljs.var-test)
128+
'cljs.var-test
129+
'cljs.proxy-test)

0 commit comments

Comments
 (0)