PageRenderTime 60ms CodeModel.GetById 37ms RepoModel.GetById 0ms app.codeStats 0ms

/src/test/clojure/clojure/tools/nrepl/helpers_test.clj

https://github.com/jwhitlark/tools.nrepl
Clojure | 48 lines | 35 code | 6 blank | 7 comment | 3 complexity | b82a7c49c62c666139382c539063f388 MD5 | raw file
  1. ; Copyright (c) Rich Hickey. All rights reserved.
  2. ; The use and distribution terms for this software are covered by the
  3. ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
  4. ; which can be found in the file epl-v10.html at the root of this distribution.
  5. ; By using this software in any fashion, you are agreeing to be bound by
  6. ; the terms of this license.
  7. ; You must not remove this notice, or any other, from this software.
  8. (ns #^{:doc ""
  9. :author "Chas Emerick"}
  10. clojure.tools.nrepl.helpers-test
  11. (:import (java.io File))
  12. (:use [clojure.tools.nrepl-test :only (def-repl-test repl-server-fixture)]
  13. clojure.test)
  14. (:require
  15. [clojure.tools.nrepl :as nrepl]
  16. [clojure.tools.nrepl.helpers :as helpers]))
  17. (use-fixtures :once repl-server-fixture)
  18. (def-repl-test load-code-with-debug-info
  19. (repl-receive "\n\n\n(defn function [])")
  20. (is (= {:file "NO_SOURCE_PATH" :line 4}
  21. (repl-value "(-> #'function meta (select-keys [:file :line]))")))
  22. (repl-receive (helpers/load-file-command
  23. "\n\n\n\n\n\n\n\n\n(defn dfunction [])"
  24. "path/from/source/root.clj"
  25. "root.clj"))
  26. (is (= [{:file "path/from/source/root.clj" :line 10}]
  27. (nrepl/values-with connection
  28. (-> #'dfunction
  29. meta
  30. (select-keys [:file :line]))))))
  31. (def-repl-test load-file-with-debug-info
  32. (repl-receive (helpers/load-file-command
  33. (File. "load-file-test/clojure/tools/nrepl/load_file_sample.clj")
  34. (File. "load-file-test")))
  35. (repl-receive (helpers/load-file-command
  36. (.getAbsolutePath (File. "load-file-test/clojure/tools/nrepl/load_file_sample.clj"))
  37. (File. "load-file-test")))
  38. (is (= [{:file "clojure/tools/nrepl/load_file_sample.clj" :line 5}]
  39. (nrepl/values-with connection
  40. (-> #'clojure.tools.nrepl.load-file-sample/dfunction
  41. meta
  42. (select-keys [:file :line]))))))