├── samples ├── dom │ ├── .gitignore │ ├── test.html │ └── src │ │ └── dom │ │ └── test.cljs ├── hello │ ├── .gitignore │ ├── src │ │ └── hello │ │ │ ├── foo │ │ │ └── bar.cljs │ │ │ └── core.cljs │ ├── hello.html │ ├── hello-dev.html │ └── README.md ├── repl │ ├── .gitignore │ ├── index.html │ ├── src │ │ └── repl │ │ │ └── test.cljs │ └── README.md ├── hello-js │ ├── .gitignore │ ├── externs.js │ ├── my-external-lib.js │ ├── externed-lib.js │ ├── src │ │ └── hello-js │ │ │ ├── extern-example.cljs │ │ │ └── core.cljs │ ├── hello-extern.html │ ├── hello-js.html │ ├── hello-js-dev.html │ └── README.md ├── twitterbuzz │ ├── .gitignore │ ├── reset.css │ ├── README.md │ ├── src │ │ └── twitterbuzz │ │ │ ├── timeline.cljs │ │ │ ├── leaderboard.cljs │ │ │ ├── anneal.cljs │ │ │ ├── radial.cljs │ │ │ ├── dom-helpers.cljs │ │ │ ├── layout.cljs │ │ │ └── showgraph.cljs │ ├── index-advanced.html │ └── index.html ├── nodehello.cljs └── nodels.cljs ├── test ├── cljs │ ├── baz.cljs │ ├── cljs │ │ ├── ns_test │ │ │ ├── bar.cljs │ │ │ └── foo.cljs │ │ ├── keyword_other.cljs │ │ ├── binding_test_other_ns.cljs │ │ ├── macro_test │ │ │ └── macros.clj │ │ ├── macro_test.cljs │ │ ├── top_level.cljs │ │ ├── binding_test.cljs │ │ ├── keyword_test.cljs │ │ ├── import_test.cljs │ │ ├── letfn_test.cljs │ │ ├── ns_test.cljs │ │ └── reducers_test.cljs │ ├── foo │ │ └── ns_shadow_test.cljs │ ├── test_runner.cljs │ └── clojure │ │ ├── data_test.cljs │ │ └── string_test.cljs ├── clj │ └── cljs │ │ ├── preamble1.js │ │ ├── preamble2.js │ │ ├── repl_tests.clj │ │ ├── compiler_tests.clj │ │ ├── closure_tests.clj │ │ └── build_api_tests.clj └── hello.cljs ├── script ├── closure-library-release │ ├── .gitignore │ ├── google-closure-library.pom.template │ ├── google-closure-library-third-party.pom.template │ └── closure-library-release.sh ├── clean ├── self-compile ├── repl ├── repl.bat ├── browser-repl ├── noderepljs ├── nashornrepljs ├── repljs ├── repljs.bat ├── test-compile ├── benchmark ├── test ├── build ├── test-simple ├── compile └── bootstrap ├── src ├── cljs │ ├── cljs │ │ ├── nodejs_externs.js │ │ ├── imul.js │ │ ├── pprint.clj │ │ ├── nodejs.cljs │ │ ├── source_map │ │ │ ├── base64.cljs │ │ │ └── base64_vlq.cljs │ │ ├── externs.js │ │ ├── nodejscli.cljs │ │ ├── repl.cljs │ │ ├── bootstrap_node.js │ │ └── pprint.cljs │ └── clojure │ │ ├── reflect.cljs │ │ ├── browser │ │ ├── event.cljs │ │ ├── dom.cljs │ │ ├── repl.cljs │ │ └── net.cljs │ │ ├── walk.cljs │ │ ├── data.cljs │ │ └── set.cljs └── clj │ └── cljs │ ├── source_map │ ├── base64.clj │ └── base64_vlq.clj │ ├── analyzer │ ├── utils.clj │ └── api.clj │ ├── tagged_literals.clj │ ├── repl │ ├── node_repl.js │ ├── reflect.clj │ └── server.clj │ ├── env.clj │ ├── util.clj │ └── build │ └── api.clj ├── devnotes ├── testing ├── bcrepl.org ├── day2.org ├── README.org ├── todo.org └── talk.org ├── .gitignore ├── bin ├── cljsc ├── cljsc.bat └── cljsc.clj ├── project.clj ├── Clojurescript.iml └── README.md /samples/dom/.gitignore: -------------------------------------------------------------------------------- 1 | out/ 2 | dom.js -------------------------------------------------------------------------------- /samples/hello/.gitignore: -------------------------------------------------------------------------------- 1 | out/ 2 | hello.js 3 | -------------------------------------------------------------------------------- /samples/repl/.gitignore: -------------------------------------------------------------------------------- 1 | out/ 2 | main.js 3 | -------------------------------------------------------------------------------- /samples/hello-js/.gitignore: -------------------------------------------------------------------------------- 1 | out/ 2 | hello*.js 3 | -------------------------------------------------------------------------------- /samples/twitterbuzz/.gitignore: -------------------------------------------------------------------------------- 1 | out/ 2 | twitterbuzz.js 3 | -------------------------------------------------------------------------------- /test/cljs/baz.cljs: -------------------------------------------------------------------------------- 1 | (ns baz) 2 | 3 | (defn f [x] x) 4 | -------------------------------------------------------------------------------- /test/clj/cljs/preamble1.js: -------------------------------------------------------------------------------- 1 | var preamble1 = require("preamble1"); -------------------------------------------------------------------------------- /test/clj/cljs/preamble2.js: -------------------------------------------------------------------------------- 1 | var preamble2 = require("preamble2"); -------------------------------------------------------------------------------- /script/closure-library-release/.gitignore: -------------------------------------------------------------------------------- 1 | closure-library/ 2 | tmp-build/ 3 | -------------------------------------------------------------------------------- /test/hello.cljs: -------------------------------------------------------------------------------- 1 | (ns hello) 2 | (defn ^:export greet [n] 3 | (str "Hello " n)) 4 | -------------------------------------------------------------------------------- /script/clean: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | rm -rf closure 4 | rm -rf compilation 5 | rm -rf lib 6 | -------------------------------------------------------------------------------- /test/cljs/cljs/ns_test/bar.cljs: -------------------------------------------------------------------------------- 1 | (ns cljs.ns-test.bar) 2 | 3 | (defn quux [] 123) 4 | -------------------------------------------------------------------------------- /test/cljs/cljs/keyword_other.cljs: -------------------------------------------------------------------------------- 1 | (ns cljs.keyword-other) 2 | 3 | (defn foo [a b] 4 | (+ a b)) 5 | -------------------------------------------------------------------------------- /samples/hello/src/hello/foo/bar.cljs: -------------------------------------------------------------------------------- 1 | (ns hello.foo.bar) 2 | 3 | (defn sum [xs] 4 | (reduce + 0 xs)) 5 | -------------------------------------------------------------------------------- /src/cljs/cljs/nodejs_externs.js: -------------------------------------------------------------------------------- 1 | var global = {}; 2 | function require(){}; 3 | function process(){}; 4 | -------------------------------------------------------------------------------- /samples/hello-js/externs.js: -------------------------------------------------------------------------------- 1 | var external = {}; 2 | external.lib = {}; 3 | external.lib.send_alert = function() {}; 4 | -------------------------------------------------------------------------------- /samples/hello-js/my-external-lib.js: -------------------------------------------------------------------------------- 1 | function send_alert(msg) { 2 | alert("Sending Alert via " + msg + "!"); 3 | }; 4 | -------------------------------------------------------------------------------- /test/cljs/cljs/binding_test_other_ns.cljs: -------------------------------------------------------------------------------- 1 | (ns cljs.binding-test-other-ns) 2 | 3 | (def ^:dynamic *foo* 1) 4 | 5 | (def bar 10) 6 | -------------------------------------------------------------------------------- /test/cljs/cljs/macro_test/macros.clj: -------------------------------------------------------------------------------- 1 | (ns cljs.macro-test.macros 2 | (:refer-clojure :exclude [==])) 3 | 4 | (defmacro == [a b] 5 | `(+ ~a ~b)) -------------------------------------------------------------------------------- /samples/hello-js/externed-lib.js: -------------------------------------------------------------------------------- 1 | external = {}; 2 | 3 | external.lib = { 4 | send_alert : function (msg) { 5 | alert("Sending Alert via " + msg + "!"); 6 | } 7 | }; 8 | -------------------------------------------------------------------------------- /script/self-compile: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | rm -rf classes 4 | mkdir classes 5 | ./script/repl -e "(compile 'cljs.repl.node) (compile 'cljs.repl.browser) (compile 'cljs.repl.rhino) (compile 'cljs.core)" 6 | -------------------------------------------------------------------------------- /samples/hello-js/src/hello-js/extern-example.cljs: -------------------------------------------------------------------------------- 1 | (ns hello.extern-example) 2 | 3 | (defn ^:export foo [] 42) 4 | 5 | (external.lib/send_alert "ClojureScript calling a function defined in an externed JavaScript library") 6 | -------------------------------------------------------------------------------- /test/cljs/cljs/macro_test.cljs: -------------------------------------------------------------------------------- 1 | (ns cljs.macro-test 2 | (:refer-clojure :exclude [==]) 3 | (:require [cljs.test :refer-macros [deftest is]]) 4 | (:use-macros [cljs.macro-test.macros :only [==]])) 5 | 6 | (deftest test-macros 7 | (is (= (== 1 1) 2))) 8 | -------------------------------------------------------------------------------- /samples/hello-js/src/hello-js/core.cljs: -------------------------------------------------------------------------------- 1 | (ns hello-js.core) 2 | 3 | (defn ^:export popup-msg 4 | [msg] 5 | (js/send_alert msg)) 6 | 7 | (popup-msg "ClojureScript calling a global function defined in an external JavaScript library") 8 | 9 | (popup-msg (str "ClojureScript: the time is now " (js/Date.))) 10 | -------------------------------------------------------------------------------- /test/cljs/cljs/ns_test/foo.cljs: -------------------------------------------------------------------------------- 1 | (ns cljs.ns-test.foo 2 | (:require [cljs.test :refer-macros [deftest is]])) 3 | 4 | (defn baz [] 123) 5 | 6 | (def kw ::foo) 7 | (def qkw '::foo) 8 | 9 | (deftest test-namespaced-keywords 10 | (is (= (str kw) ":cljs.ns-test.foo/foo")) 11 | (is (= (str qkw) ":cljs.ns-test.foo/foo"))) 12 | -------------------------------------------------------------------------------- /devnotes/testing: -------------------------------------------------------------------------------- 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 | 14 | -------------------------------------------------------------------------------- /test/cljs/cljs/top_level.cljs: -------------------------------------------------------------------------------- 1 | (ns cljs.top-level 2 | (:refer-clojure :exclude [test]) 3 | (:require [cljs.test :refer-macros [deftest is]])) 4 | 5 | (let [foo 1] 6 | (defn bar [] 7 | foo)) 8 | 9 | (let [foo 2] 10 | (defn baz [] 11 | foo)) 12 | 13 | (deftest test 14 | (is (= (bar) 1)) 15 | (is (= (baz) 2))) 16 | -------------------------------------------------------------------------------- /script/repl: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "$CLOJURESCRIPT_HOME" = "" ]; then 4 | CLOJURESCRIPT_HOME="`dirname $0`/.." 5 | fi 6 | 7 | CLJSC_CP='' 8 | for next in classes: lib/*: src/clj: src/cljs: test/cljs; do 9 | CLJSC_CP="${CLJSC_CP}${CLOJURESCRIPT_HOME}/${next}" 10 | done 11 | 12 | java -server -cp "$CLJSC_CP" clojure.main "$@" 13 | 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | .idea 3 | /.DS_Store 4 | /classes 5 | /lib 6 | /target 7 | closure 8 | /core.js 9 | /coreadvanced.js 10 | /coresimple.js 11 | /out 12 | *out 13 | .lein* 14 | /pom.xml 15 | .repl* 16 | *.swp 17 | *.zip 18 | clojurescript_release_* 19 | closure-release-* 20 | .lein-repl-history 21 | .nrepl-port 22 | .nrepl-repl-history 23 | builds 24 | .cljs* 25 | node_modules 26 | -------------------------------------------------------------------------------- /test/cljs/cljs/binding_test.cljs: -------------------------------------------------------------------------------- 1 | (ns cljs.binding-test 2 | (:require [cljs.test :refer-macros [deftest is]] 3 | [cljs.binding-test-other-ns :as o])) 4 | 5 | (deftest test-binding 6 | (is (binding [o/*foo* 2] 7 | (= o/*foo* 2))) 8 | (is (= o/*foo* 1))) 9 | 10 | (deftest test-with-redefs 11 | (is (with-redefs [o/bar 2] 12 | (= o/bar 2))) 13 | (is (= o/bar 10))) 14 | -------------------------------------------------------------------------------- /test/cljs/cljs/keyword_test.cljs: -------------------------------------------------------------------------------- 1 | (ns cljs.keyword-test 2 | (:require-macros [clojure.core :as cc] 3 | [cljs.test :refer [deftest is]]) 4 | (:require [cljs.keyword-other :as other] 5 | [cljs.test])) 6 | 7 | (deftest test-keyword 8 | (is (= ::bar :cljs.keyword-test/bar)) 9 | (is (= ::other/foo :cljs.keyword-other/foo)) 10 | (is (= ::cc/foo :clojure.core/foo))) 11 | -------------------------------------------------------------------------------- /samples/hello/hello.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |