|
106 | 106 | :and-return-value '()) |
107 | 107 | (expect (cider-project-type) :to-equal cider-jack-in-default)))) |
108 | 108 |
|
| 109 | +;; `cider--enriched-cmd-p', test different path + script-name combinations |
| 110 | +(let* ((paths `("/simple/path/" |
| 111 | + ,(shell-quote-argument "/tmp/path/ with spaces/") |
| 112 | + ,(shell-quote-argument "/ssh:!slightly@cra --zy!path #enrich me/"))) |
| 113 | + (simple-names (map-values cider--enrich-classpath-script-names)) |
| 114 | + (tmp-names (mapcar (lambda (s) (cider--make-temp-name s)) simple-names)) |
| 115 | + (names (seq-concatenate 'list simple-names tmp-names )) |
| 116 | + (tests |
| 117 | + (lambda (script) |
| 118 | + (describe (format "cider--enriched-cmd-p with %s" script) |
| 119 | + (it "Returns the script path when cmd contains an enrich-classpath script." |
| 120 | + (expect (cider--enriched-cmd-p (concat "bash " script " /usr/bin/lein")) |
| 121 | + :to-equal script) |
| 122 | + (expect (cider--enriched-cmd-p (concat "TEST=1 bash " script " /usr/bin/env lein")) |
| 123 | + :to-equal script)) |
| 124 | + ;; FIXME pretty useless to do this multiple times? |
| 125 | + (it "Returns nil when the cmd does not contain an enrich-classpath script." |
| 126 | + (expect (cider--enriched-cmd-p "/usr/bin/lein") |
| 127 | + :to-equal nil) |
| 128 | + (expect (cider--enriched-cmd-p "bash /usr/bin/lein") |
| 129 | + :to-equal nil)) |
| 130 | + (it "Handles a fully constructed jack-in-cmd." |
| 131 | + ;; TODO generate this |
| 132 | + (let ((cmd (concat "bash " script " /usr/local/bin/lein update-in :dependencies conj \[nrepl/nrepl\ \"1.0.0\"\] -- update-in :plugins conj \[cider/cider-nrepl\ \"0.43.0\"\] -- update-in :plugins conj \[mx.cider/lein-enrich-classpath\ \"1.18.2\"\] -- update-in :middleware conj cider.enrich-classpath.plugin-v2/middleware -- repl :headless :host localhost"))) |
| 133 | + (expect (cider--enriched-cmd-p cmd) |
| 134 | + :to-equal script))))))) |
| 135 | + (cl-loop for path in paths do |
| 136 | + (cl-loop for name in names do |
| 137 | + (funcall tests (concat path name))))) |
| 138 | + |
109 | 139 | ;;; cider-jack-in tests |
110 | 140 | (describe "cider--gradle-dependency-notation" |
111 | 141 | (it "returns a GAV when given a two-element list" |
|
0 commit comments