Skip to content
This repository
Browse code

Get unit tests passing again

  • Loading branch information...
commit 1b1136b8cf217e24ad353efbf2d321c0c3eb8b39 1 parent 75cef5f
Colin Jones authored
1  project.clj
@@ -23,4 +23,5 @@
23 23 :java-source-paths ["src/java"]
24 24 :test-paths ["spec"]
25 25 :repl-options {:init-ns user}
  26 + :aot [reply.reader.jline.JlineInputReader]
26 27 :main ^{:skip-aot true} reply.ReplyMain))
17 spec/reply/eval_modes/nrepl_spec.clj
@@ -4,38 +4,41 @@
4 4
5 5 (describe "parsed-forms"
6 6 (with eof (Object.))
  7 + (around [it]
  8 + (with-redefs [safe-read-line (fn [state] (read-line))]
  9 + (it)))
7 10
8 11 (it "gets an eof when readLine says it's done"
9 12 (should= [@eof]
10 13 (with-in-str ""
11   - (doall (parsed-forms @eof)))))
  14 + (doall (parsed-forms {:request-exit @eof})))))
12 15
13 16 (it "gets one form"
14 17 (should= ["foo"]
15 18 (with-in-str "foo"
16   - (doall (parsed-forms @eof)))))
  19 + (doall (parsed-forms {:request-exit @eof})))))
17 20
18 21 (it "gets multiline forms"
19 22 (should= ["(+ 1 2\n3)"]
20 23 (with-in-str "(+ 1 2\n3)"
21   - (doall (parsed-forms @eof)))))
  24 + (doall (parsed-forms {:request-exit @eof})))))
22 25
23 26 (it "gets multiline forms, with overlap"
24 27 (should= ["(+ 1 2\n3)" "(- 3\n1)"]
25 28 (with-in-str "(+ 1 2\n3) (- 3\n1)"
26   - (doall (parsed-forms @eof)))))
  29 + (doall (parsed-forms {:request-exit @eof})))))
27 30
28 31 (it "gets multiple forms on a single line"
29 32 (should= ["1" "2" "3"]
30 33 (with-in-str "1 2 3"
31   - (doall (parsed-forms @eof)))))
  34 + (doall (parsed-forms {:request-exit @eof})))))
32 35
33 36 (it "gets an empty couple of lines"
34 37 (should= [""]
35 38 (with-in-str "\n\n"
36   - (doall (parsed-forms @eof)))))
  39 + (doall (parsed-forms {:request-exit @eof})))))
37 40
38 41 (it "gets whitespace"
39 42 (should= [""]
40 43 (with-in-str " \n \n"
41   - (doall (parsed-forms @eof))))))
  44 + (doall (parsed-forms {:request-exit @eof}))))))
4 spec/reply/reader/jline/completion_spec.clj
@@ -4,6 +4,6 @@
4 4
5 5 (describe "construct-possible-completions-form"
6 6 (it "does correct quoting in completions form request"
7   - (should= '(complete.core/completions (str "clojure.core/map-") *ns*)
8   - (construct-possible-completions-form "clojure.core/map-"))))
  7 + (should= '(complete.core/completions (str "clojure.core/map-") (symbol "user"))
  8 + (construct-possible-completions-form "clojure.core/map-" "user"))))
9 9
5 src/clj/reply/eval_modes/nrepl.clj
@@ -57,8 +57,9 @@
57 57 (defn execute-with-client [client options form]
58 58 (let [command-id (nrepl.misc/uuid)
59 59 session (or (:session options) @current-session)
60   - session-sender (nrepl/client-session client :session session)]
61   - (session-sender {:op "eval" :code form :id command-id})
  60 + session-sender (nrepl/client-session client :session session)
  61 + message-to-send {:op "eval" :code form :id command-id}]
  62 + (session-sender message-to-send)
62 63 (reset! current-command-id command-id)
63 64 (doseq [{:keys [ns value out err] :as res}
64 65 (take-while
2  src/clj/reply/reader/jline/completion.clj
@@ -4,7 +4,7 @@
4 4 (:import [jline.console.completer Completer]))
5 5
6 6 (defn construct-possible-completions-form [prefix ns]
7   - `(~'complete.core/completions (~'str ~prefix) (symbol '~ns)))
  7 + `(~'complete.core/completions (~'str ~prefix) (~'symbol ~ns)))
8 8
9 9 (defn make-completer [eval-fn redraw-line-fn ns]
10 10 (proxy [Completer] []
3  src/clj/reply/reader/simple_jline.clj
@@ -18,6 +18,7 @@
18 18
19 19 (defn shutdown [{:keys [reader] :as state}]
20 20 (when reader
  21 + (.clear (.getCursorBuffer reader))
21 22 (.restore (.getTerminal reader))
22 23 (.shutdown reader)))
23 24
@@ -66,7 +67,7 @@
66 67 (initialize-jline))
67 68 (if (:no-jline state)
68 69 (do
69   - (shutdown state) ; TODO: this prints a newline; stop jline from doing this.
  70 + (shutdown state)
70 71 (assoc (dissoc state :no-jline)
71 72 :reader nil
72 73 :input (read-line)))

0 comments on commit 1b1136b

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