Skip to content
This repository
Browse code

Add some eval tests.

  • Loading branch information...
commit 006cb693e8ce3a35d2eb598990870cb64617c871 1 parent a44c152
Anthony Grimes authored November 29, 2011
6  test/tryclojure/core_test.clj
... ...
@@ -1,6 +0,0 @@
1  
-(ns tryclojure.core-test
2  
-  (:use [tryclojure.core] :reload-all)
3  
-  (:use [clojure.test]))
4  
-
5  
-(deftest replace-me ;; FIXME: write
6  
-  (is false))
18  test/tryclojure/eval_test.clj
... ...
@@ -0,0 +1,18 @@
  1
+(ns tryclojure.eval-test
  2
+  (:use tryclojure.models.eval
  3
+        clojure.test)
  4
+  (:require noir.session))
  5
+
  6
+(def sb (make-sandbox))
  7
+
  8
+(deftest eval-form-test
  9
+  (let [form "(do (println 10) (+ 3 3))"
  10
+        result (eval-string form sb)]
  11
+    (is (= "10\n" (-> result :result first str)))
  12
+    (is (= "6" (-> result :result second str)))
  13
+    (is (= (read-string form) (-> result :expr)))))
  14
+
  15
+(alter-var-root #'noir.session/*noir-session* (constantly (atom {})))
  16
+
  17
+(deftest eval-request-test
  18
+  (is (= "Execution Timed Out!" (:message (eval-request "(while true)")))))

0 notes on commit 006cb69

Please sign in to comment.
Something went wrong with that request. Please try again.