Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Get unit tests passing again

  • Loading branch information...
commit 1b1136b8cf217e24ad353efbf2d321c0c3eb8b39 1 parent 75cef5f
@trptcolin authored
View
1  project.clj
@@ -23,4 +23,5 @@
:java-source-paths ["src/java"]
:test-paths ["spec"]
:repl-options {:init-ns user}
+ :aot [reply.reader.jline.JlineInputReader]
:main ^{:skip-aot true} reply.ReplyMain))
View
17 spec/reply/eval_modes/nrepl_spec.clj
@@ -4,38 +4,41 @@
(describe "parsed-forms"
(with eof (Object.))
+ (around [it]
+ (with-redefs [safe-read-line (fn [state] (read-line))]
+ (it)))
(it "gets an eof when readLine says it's done"
(should= [@eof]
(with-in-str ""
- (doall (parsed-forms @eof)))))
+ (doall (parsed-forms {:request-exit @eof})))))
(it "gets one form"
(should= ["foo"]
(with-in-str "foo"
- (doall (parsed-forms @eof)))))
+ (doall (parsed-forms {:request-exit @eof})))))
(it "gets multiline forms"
(should= ["(+ 1 2\n3)"]
(with-in-str "(+ 1 2\n3)"
- (doall (parsed-forms @eof)))))
+ (doall (parsed-forms {:request-exit @eof})))))
(it "gets multiline forms, with overlap"
(should= ["(+ 1 2\n3)" "(- 3\n1)"]
(with-in-str "(+ 1 2\n3) (- 3\n1)"
- (doall (parsed-forms @eof)))))
+ (doall (parsed-forms {:request-exit @eof})))))
(it "gets multiple forms on a single line"
(should= ["1" "2" "3"]
(with-in-str "1 2 3"
- (doall (parsed-forms @eof)))))
+ (doall (parsed-forms {:request-exit @eof})))))
(it "gets an empty couple of lines"
(should= [""]
(with-in-str "\n\n"
- (doall (parsed-forms @eof)))))
+ (doall (parsed-forms {:request-exit @eof})))))
(it "gets whitespace"
(should= [""]
(with-in-str " \n \n"
- (doall (parsed-forms @eof))))))
+ (doall (parsed-forms {:request-exit @eof}))))))
View
4 spec/reply/reader/jline/completion_spec.clj
@@ -4,6 +4,6 @@
(describe "construct-possible-completions-form"
(it "does correct quoting in completions form request"
- (should= '(complete.core/completions (str "clojure.core/map-") *ns*)
- (construct-possible-completions-form "clojure.core/map-"))))
+ (should= '(complete.core/completions (str "clojure.core/map-") (symbol "user"))
+ (construct-possible-completions-form "clojure.core/map-" "user"))))
View
5 src/clj/reply/eval_modes/nrepl.clj
@@ -57,8 +57,9 @@
(defn execute-with-client [client options form]
(let [command-id (nrepl.misc/uuid)
session (or (:session options) @current-session)
- session-sender (nrepl/client-session client :session session)]
- (session-sender {:op "eval" :code form :id command-id})
+ session-sender (nrepl/client-session client :session session)
+ message-to-send {:op "eval" :code form :id command-id}]
+ (session-sender message-to-send)
(reset! current-command-id command-id)
(doseq [{:keys [ns value out err] :as res}
(take-while
View
2  src/clj/reply/reader/jline/completion.clj
@@ -4,7 +4,7 @@
(:import [jline.console.completer Completer]))
(defn construct-possible-completions-form [prefix ns]
- `(~'complete.core/completions (~'str ~prefix) (symbol '~ns)))
+ `(~'complete.core/completions (~'str ~prefix) (~'symbol ~ns)))
(defn make-completer [eval-fn redraw-line-fn ns]
(proxy [Completer] []
View
3  src/clj/reply/reader/simple_jline.clj
@@ -18,6 +18,7 @@
(defn shutdown [{:keys [reader] :as state}]
(when reader
+ (.clear (.getCursorBuffer reader))
(.restore (.getTerminal reader))
(.shutdown reader)))
@@ -66,7 +67,7 @@
(initialize-jline))
(if (:no-jline state)
(do
- (shutdown state) ; TODO: this prints a newline; stop jline from doing this.
+ (shutdown state)
(assoc (dissoc state :no-jline)
:reader nil
:input (read-line)))
Please sign in to comment.
Something went wrong with that request. Please try again.