Permalink
Browse files

Add some eval tests.

  • Loading branch information...
1 parent a44c152 commit 006cb693e8ce3a35d2eb598990870cb64617c871 @Raynes committed Nov 29, 2011
Showing with 18 additions and 6 deletions.
  1. +0 −6 test/tryclojure/core_test.clj
  2. +18 −0 test/tryclojure/eval_test.clj
@@ -1,6 +0,0 @@
-(ns tryclojure.core-test
- (:use [tryclojure.core] :reload-all)
- (:use [clojure.test]))
-
-(deftest replace-me ;; FIXME: write
- (is false))
@@ -0,0 +1,18 @@
+(ns tryclojure.eval-test
+ (:use tryclojure.models.eval
+ clojure.test)
+ (:require noir.session))
+
+(def sb (make-sandbox))
+
+(deftest eval-form-test
+ (let [form "(do (println 10) (+ 3 3))"
+ result (eval-string form sb)]
+ (is (= "10\n" (-> result :result first str)))
+ (is (= "6" (-> result :result second str)))
+ (is (= (read-string form) (-> result :expr)))))
+
+(alter-var-root #'noir.session/*noir-session* (constantly (atom {})))
+
+(deftest eval-request-test
+ (is (= "Execution Timed Out!" (:message (eval-request "(while true)")))))

0 comments on commit 006cb69

Please sign in to comment.