Skip to content
This repository has been archived by the owner on Feb 5, 2024. It is now read-only.

Update dependencies & add tests #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/*/target/
.nrepl-port
6 changes: 3 additions & 3 deletions nreplds/project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
:url "https://github.com/monsanto/nreplds"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.5.1"]
[org.clojure/tools.nrepl "0.2.3"]
[org.newsclub/junixsocket "1.3"]])
:dependencies [[org.clojure/clojure "1.7.0"]
[org.clojure/tools.nrepl "0.2.12"]
[com.kohlschutter.junixsocket/junixsocket-native-common "2.0.4"]])
36 changes: 36 additions & 0 deletions nreplds/test/nreplds/core_test.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
(ns nreplds.core-test
(:require [clojure.test :refer :all]
[nreplds.core :refer :all]
[clojure.tools.nrepl :as nrepl])
(:import java.net.URI
(java.nio.file Files attribute.FileAttribute)))

(def socket-file
(-> "nreplds-core-test"
(Files/createTempDirectory (make-array FileAttribute 0))
(.resolve "socket")
.toFile))

(def socket-uri
(URI. "nreplds" (str socket-file) nil))

(def ^:dynamic *server*)

(use-fixtures :once
#(with-open [server (start-server :path socket-file)]
(binding [*server* server]
(%))))

(defn- repl-eval [client code]
(nrepl/response-values (nrepl/message client {:op "eval" :code code})))

(defn- validate-transport [transport]
(with-open [t transport]
(is (= [5] (repl-eval (nrepl/client transport 1000)
(nrepl/code (+ 2 3)))))))

(deftest test-connect
(validate-transport (connect :path socket-file)))

(deftest test-url-connect
(validate-transport (nrepl/url-connect socket-uri)))