Socket repl tests fix

This commit is contained in:
Michiel Borkent 2019-12-07 23:10:34 +01:00
parent 612e6f38fb
commit a5be01c740
2 changed files with 8 additions and 8 deletions

2
sci

@ -1 +1 @@
Subproject commit f1778710e94d4e12dfce7dccb6ee0a301eccefcc Subproject commit 60778bfaabf4fbed635d9490bac88b86fdfb0e4d

View file

@ -21,8 +21,7 @@
(when-let [l (.readLine ^java.io.BufferedReader reader)] (when-let [l (.readLine ^java.io.BufferedReader reader)]
(binding [*out* sw] (binding [*out* sw]
(println l)) (println l))
(when-not (str/includes? l expected) (recur)))
(recur))))
(let [s (str sw)] (let [s (str sw)]
(is (str/includes? s expected) (is (str/includes? s expected)
(format "\"%s\" does not contain \"%s\"" (format "\"%s\" does not contain \"%s\""
@ -46,15 +45,15 @@
(while (not (zero? (:exit (while (not (zero? (:exit
(sh "bash" "-c" (sh "bash" "-c"
"lsof -t -i:1666")))))) "lsof -t -i:1666"))))))
(is (socket-command '(+ 1 2 3) "user=> 6")) (is (socket-command "(+ 1 2 3)" "user=> 6"))
(testing "*in*" (testing "*in*"
(is (socket-command "*in*" "[1 2 3]"))) (is (socket-command "*in*" "[1 2 3]")))
(testing "*command-line-args*" (testing "*command-line-args*"
(is (socket-command '*command-line-args* "\"a\" \"b\" \"c\""))) (is (socket-command '*command-line-args* "\"a\" \"b\" \"c\"")))
(testing "&env" (testing "&env"
(socket-command '(defmacro bindings [] (mapv #(list 'quote %) (keys &env))) "") (socket-command "(defmacro bindings [] (mapv #(list 'quote %) (keys &env)))" "bindings")
(socket-command '(defn bar [x y z] (bindings)) "") (socket-command "(defn bar [x y z] (bindings))" "bar")
(is (socket-command '(bar 1 2 3) "[x y z]"))) (is (socket-command "(bar 1 2 3)" "[x y z]")))
(testing "reader conditionals" (testing "reader conditionals"
(is (socket-command "#?(:bb 1337 :clj 8888)" "1337"))) (is (socket-command "#?(:bb 1337 :clj 8888)" "1337")))
(testing "*1, *2, *3, *e" (testing "*1, *2, *3, *e"
@ -69,7 +68,8 @@
(comment (comment
(socket-repl-test) (socket-repl-test)
(t/run-tests) (dotimes [_ 1000]
(t/run-tests))
(stop-repl!) (stop-repl!)
(start-repl! "0.0.0.0:1666" {:bindings {(with-meta '*in* (start-repl! "0.0.0.0:1666" {:bindings {(with-meta '*in*
{:sci/deref! true}) {:sci/deref! true})