File tree 9 files changed +667
-627
lines changed 9 files changed +667
-627
lines changed Original file line number Diff line number Diff line change
1
+ Definitely a work-in-progress.
2
+
3
+ To run tests before you commit:
4
+
5
+ script/test
6
+
7
+ To add tests:
8
+
9
+ * Create test fiels in the test/cljs directory.
10
+ * Write fns that throw an exception on failure.
11
+ * Call those fns from test/cljs/cljs/test_runner.cljs
12
+
13
+
Original file line number Diff line number Diff line change 1
1
#! /bin/sh
2
- java -server -Xmx2G -Xms2G -Xmn256m -cp ' lib/*:src/clj:src/cljs' clojure.main
2
+ java -server -Xmx2G -Xms2G -Xmn256m -cp ' lib/*:src/clj:src/cljs:test/cljs ' clojure.main
3
3
Original file line number Diff line number Diff line change 1
1
#! /bin/sh
2
- java -server -Xmx2G -Xms2G -Xmn256m -cp ' lib/*:src/clj:src/cljs' clojure.main -e \
2
+ java -server -Xmx2G -Xms2G -Xmn256m -cp ' lib/*:src/clj:src/cljs:test/cljs ' clojure.main -e \
3
3
" (require '[cljs.compiler :as comp])
4
4
(def jse (comp/repl-env))
5
5
(comp/repl jse)"
Original file line number Diff line number Diff line change
1
+ mkdir -p out
2
+
3
+ bin/cljsc test > out/core-test.js
4
+ bin/cljsc test {:optimizations :advanced} > out/core-advanced-test.js
5
+
6
+ if [ "$V8_HOME" == "" ]; then
7
+ echo "V8_HOME not set, skipping V8 tests"
8
+ else
9
+ ${V8_HOME}/d8 out/core-advanced-test.js
10
+ # TODO: figure out path problem when not in advanced mode
11
+ # ${V8_HOME}/d8 out/core-test.js
12
+ fi
13
+
14
+ # TODO : run tests with rhino if available
Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change @@ -345,22 +345,4 @@ nil if the end of stream has been reached")
345
345
(let [r (push-back-reader s)]
346
346
(read r true nil false )))
347
347
348
- ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Tests ;;;;;;;;;;;;;;;;
349
-
350
- (defn test-reader
351
- []
352
- (assert (= 1 (read-string " 1" )))
353
- (assert (= 2 (read-string " #_nope 2" )))
354
- (assert (= [3 4 ] (read-string " [3 4]" )))
355
- (assert (= " foo" (read-string " \" foo\" " )))
356
- (assert (= :hello (read-string " :hello" )))
357
- (assert (= 'goodbye (read-string " goodbye" )))
358
- (assert (= #{1 2 3 } (read-string " #{1 2 3}" )))
359
- (assert (= '(7 8 9 ) (read-string " (7 8 9)" )))
360
- (assert (= '(deref foo) (read-string " @foo" )))
361
- (assert (= '(quote bar) (read-string " 'bar" )))
362
- (assert (= \a (read-string " \\ a" )))
363
- (assert (= {:tag 'String} (meta (read-string " ^String {:a 1}" ))))
364
- (assert (= [:a 'b #{'c {:d [:e :f :g ]}}]
365
- (read-string " [:a b #{c {:d [:e :f :g]}}]" ))))
366
348
Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change
1
+ (ns cljs.reader-test
2
+ (:require [cljs.reader :as reader]))
3
+
4
+ (defn test-reader
5
+ []
6
+ (assert (= 1 (reader/read-string " 1" )))
7
+ (assert (= 2 (reader/read-string " #_nope 2" )))
8
+ (assert (= [3 4 ] (reader/read-string " [3 4]" )))
9
+ (assert (= " foo" (reader/read-string " \" foo\" " )))
10
+ (assert (= :hello (reader/read-string " :hello" )))
11
+ (assert (= 'goodbye (reader/read-string " goodbye" )))
12
+ (assert (= #{1 2 3 } (reader/read-string " #{1 2 3}" )))
13
+ (assert (= '(7 8 9 ) (reader/read-string " (7 8 9)" )))
14
+ (assert (= '(deref foo) (reader/read-string " @foo" )))
15
+ (assert (= '(quote bar) (reader/read-string " 'bar" )))
16
+ (assert (= \a (reader/read-string " \\ a" )))
17
+ (assert (= {:tag 'String} (meta (reader/read-string " ^String {:a 1}" ))))
18
+ (assert (= [:a 'b #{'c {:d [:e :f :g ]}}]
19
+ (reader/read-string " [:a b #{c {:d [:e :f :g]}}]" )))
20
+ :ok )
Original file line number Diff line number Diff line change
1
+ (ns cljs.test-runner
2
+ (:require [cljs.core-test :as core-test]
3
+ [cljs.reader-test :as reader-test]))
4
+
5
+ (core-test/test-stuff )
6
+ (reader-test/test-reader )
7
+
8
+ (println " Tests completed without exception" )
9
+
10
+
You can’t perform that action at this time.
0 commit comments