Hey all,

I'm digging into ClojureScript at the moment, and am trying to figure out
how to automate generated JS code in a shell, like v8.


In ClojureScript, I have been able to to pull in Google Closure's "*
goog.testing.jsunit*" package. Next step is to take the generated JS code
(optimized or not), and be able to automate tests in a JS shell, like v8,
SpiderMonkey, rhino, etc. This is where I run into problems. In the
directory in which I ran "cljs", I run v8, then load "*out/goog/base.js*"
(analogous to what you'd do in a browser). "*bkeeping.js*" is generated from
"*bkeeping.cljs*". goog.require breaks at first, until I try it with fubar'd
namespace. Then I retry goog.require, and it works. However, I don't see the
results of the unit test run.


Any ideas of what I'm missing?


Thanks for any help

Tim



*OUTPUT*

webkell@ubuntu:~/Projects/bkell/test/cljs$ cljsc bkeeping.cljs >
bkeeping.js

webkell@ubuntu:~/Projects/bkell/test/cljs$ v8

V8 version 3.5.3

>

> load('out/goog/base.js');

> load('bkeeping.js');


…

*
*

*> goog.require("bkeeping"); *

*out/goog/base.js:517: Error: Undefined nameToPath for goog.string*

*            throw Error('Undefined nameToPath for ' + requireName);*

*                  ^*

*Error: Undefined nameToPath for goog.string*

*    at Error (unknown source)*

*    at visitNode (out/goog/base.js:517:19)*

*    at visitNode (out/goog/base.js:512:13)*

*    at Object.writeScripts_ (out/goog/base.js:530:9)*

*    at Object.require (out/goog/base.js:280:12)*

*    at (shell):1:6*


…


> goog.require("xx");

out/goog/base.js:287: Error: goog.require could not find: xx

        throw Error(errorMessage);

              ^

Error: goog.require could not find: xx

    at Error (unknown source)

    at Object.require (out/goog/base.js:287:15)

    at (shell):1:6

>

>

>

*> goog.require("bkeeping");*



*Source "bkeeping.cljs" *

(ns bkeeping

  (:require [goog.testing.jsunit :as testing]))




;;(defn ^:export run-tests []

(defn run-tests []



  (testing/assertFalse false, "PASSED falsity")

  (testing/assertTrue true, "PASSED truthiness")

)


(run-tests)

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to