From e38d37bf5902ef043315eb46963941d75c54b9ae Mon Sep 17 00:00:00 2001 From: Oleksandr Yakushev Date: Mon, 5 May 2025 14:18:33 +0300 Subject: [PATCH] Remove enrich-classpath support from cider-jack-in --- .github/workflows/test.yml | 7 -- CHANGELOG.md | 8 ++ Eldev | 5 +- Makefile | 8 +- cider-client.el | 2 +- cider.el | 77 +++--------------- clojure.sh | 54 ------------- .../ROOT/pages/config/basic_config.adoc | 23 ------ doc/modules/ROOT/pages/troubleshooting.adoc | 21 ++--- lein.sh | 45 ----------- test/cider-tests.el | 46 +---------- test/enrich/cider-docstring-tests.el | 78 ------------------- 12 files changed, 28 insertions(+), 346 deletions(-) delete mode 100755 clojure.sh delete mode 100755 lein.sh delete mode 100644 test/enrich/cider-docstring-tests.el diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7b012716b..5e82a8456 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -106,13 +106,6 @@ jobs: # problem by rerunning the tests more than once. eldev -p -dtTC test --test-type integration || eldev -p -dtTC test --test-type integration - - name: Run tests that need enrich-classpath - if: "!startsWith(matrix.os, 'windows')" - run: | - cd dev; ../clojure.sh clojure -M:gen; cd - - wc -l test/File.edn - eldev -p -dtTC test --test-type enrich || eldev -p -dtTC test --test-type enrich - - name: Test clojure-ts-mode if: startsWith (matrix.emacs_version, '30') run: | diff --git a/CHANGELOG.md b/CHANGELOG.md index 97aeda91e..b98c84b5c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ ## master (unreleased) +### New features + +### Changes + +- [#3816](https://github.com/clojure-emacs/cider/issues/3816): **(Breaking)** Remove enrich-classpath support from cider-jack-in. + +### Bugs fixed + ## 1.18.0 (2025-04-30) ### New features diff --git a/Eldev b/Eldev index ca7620a0e..f13ab89ff 100644 --- a/Eldev +++ b/Eldev @@ -25,7 +25,6 @@ (eldev-pcase-exhaustive cider-test-type (`main "./test/*/") (`integration '("./test/" "!./test/integration")) - (`enrich '("./test/" "!./test/enrich")) (`clojure-ts-mode '("./test/*/" "!./test/clojure-ts-mode")) (`all '("./test/*/" "!./test/integration"))) "test/integration/projects" @@ -34,12 +33,12 @@ "test/cider-tests--no-auto.el")) (eldev-defoption cider-test-selection (type) - "Select tests to run; type can be `main', `integration', `enrich', `clojure-ts-mode' or `all'" + "Select tests to run; type can be `main', `integration', `clojure-ts-mode' or `all'" :options (-T --test-type) :for-command test :value TYPE :default-value cider-test-type - (unless (memq (intern type) '(main integration enrich clojure-ts-mode all)) + (unless (memq (intern type) '(main integration clojure-ts-mode all)) (signal 'eldev-wrong-option-usage `("unknown test type `%s'" ,type))) (setf cider-test-type (intern type))) diff --git a/Makefile b/Makefile index 2fc0ae757..8dc54b300 100644 --- a/Makefile +++ b/Makefile @@ -19,15 +19,9 @@ lint: clean compile: clean eldev -dtT compile --warnings-as-errors -test/File.edn: - cd dev; ../clojure.sh clojure -M:gen - -test-all: clean test/File.edn +test-all: clean eldev -dtT -p test --test-type all -test-enrich: clean test/File.edn - eldev -dtT -p test --test-type enrich - test-integration: clean eldev -dtT -p test --test-type integration diff --git a/cider-client.el b/cider-client.el index 32cc63b3e..31bd82602 100644 --- a/cider-client.el +++ b/cider-client.el @@ -339,7 +339,7 @@ The default value in nREPL is 1024." :group 'cider :package-version '(cider . "0.25.0")) -(defcustom cider-download-java-sources nil +(defcustom cider-download-java-sources t "Whether to automatically download source artifacts for 3rd-party Java classes. When enabled, CIDER will attempt to download source JARs from Maven for diff --git a/cider.el b/cider.el index a80b9f9a5..0caa688a3 100644 --- a/cider.el +++ b/cider.el @@ -307,6 +307,7 @@ By default we favor the project-specific shadow-cljs over the system-wide." (make-obsolete-variable 'cider-gradle-global-options 'cider-gradle-parameters "1.8.0") (make-obsolete-variable 'cider-babashka-global-options 'cider-babashka-parameters "1.8.0") (make-obsolete-variable 'cider-nbb-global-options 'cider-nbb-parameters "1.8.0") +(make-obsolete-variable 'cider-enrich-classpath nil "1.19.0") (defcustom cider-jack-in-default (if (executable-find "clojure") 'clojure-cli 'lein) @@ -453,49 +454,16 @@ The plist supports the following keys (_ (user-error "Unsupported project type `%S'" project-type)))) (defcustom cider-enrich-classpath nil - "If t, use enrich-classpath for adding sources/javadocs to the classpath. - -enrich-classpath is a Clojure CLI shim, and Leiningen plugin. - -This classpath expansion is done in a clean manner, -without interfering with classloaders." + "Removed." :type 'boolean - :package-version '(cider . "1.2.0") :safe #'booleanp) -(defun cider--get-enrich-classpath-lein-script () - "Returns the location of enrich-classpath's lein.sh wrapper script." - (when-let ((cider-location (locate-library "cider.el" t))) - (concat (file-name-directory cider-location) - "lein.sh"))) - -(defun cider--get-enrich-classpath-clojure-cli-script () - "Returns the location of enrich-classpath's clojure.sh wrapper script." - (when-let ((cider-location (locate-library "cider.el" t))) - (concat (file-name-directory cider-location) - "clojure.sh"))) - (defun cider-jack-in-resolve-command (project-type) "Determine the resolved file path to `cider-jack-in-command'. Throws an error if PROJECT-TYPE is unknown." (pcase project-type - ('lein (let ((r (cider--resolve-command cider-lein-command))) - (if (and cider-enrich-classpath - (not (eq system-type 'windows-nt)) - (executable-find (cider--get-enrich-classpath-lein-script))) - (concat "bash " ;; don't assume lein.sh is executable - MELPA might change that - (cider--get-enrich-classpath-lein-script) - " " - r) - r))) - ('clojure-cli (if (and cider-enrich-classpath - (not (eq system-type 'windows-nt)) - (executable-find (cider--get-enrich-classpath-clojure-cli-script))) - (concat "bash " ;; don't assume clojure.sh is executable - MELPA might change that - (cider--get-enrich-classpath-clojure-cli-script) - " " - (cider--resolve-command cider-clojure-cli-command)) - (cider--resolve-command cider-clojure-cli-command))) + ('lein (cider--resolve-command cider-lein-command)) + ('clojure-cli (cider--resolve-command cider-clojure-cli-command)) ('babashka (cider--resolve-command cider-babashka-command)) ;; here we have to account for the possibility that the command is either ;; "npx shadow-cljs" or just "shadow-cljs" @@ -649,12 +617,8 @@ Added to `cider-jack-in-lein-plugins' (which see) when doing "Return a normalized list of Leiningen plugins to be injected. See `cider-jack-in-lein-plugins' for the format, except that the list returned by this function does not include keyword arguments." - (let ((plugins (if cider-enrich-classpath - (append cider-jack-in-lein-plugins - `(("cider/cider-nrepl" ,cider-injected-middleware-version) - ("mx.cider/lein-enrich-classpath" "1.19.3"))) - (append cider-jack-in-lein-plugins - `(("cider/cider-nrepl" ,cider-injected-middleware-version)))))) + (let ((plugins (append cider-jack-in-lein-plugins + `(("cider/cider-nrepl" ,cider-injected-middleware-version))))) (thread-last plugins (seq-filter (lambda (spec) @@ -765,18 +729,6 @@ of EXCLUSIONS can be provided as well. The returned string is quoted for passing as argument to an inferior shell." (shell-quote-argument (format "[%s %S%s]" (car list) (cadr list) (cider--lein-artifact-exclusions exclusions)))) -(defun cider--extract-lein-profiles (lein-params) - "Extracts a list of ('with-profile ...' and a repl command from LEIN-PARAMS). - -If no `with-profile' call was found, -returns an empty string as the first member." - (or (when-let* ((pattern "\\(with-profiles?\\s-+\\S-+\\)") - (match-start (string-match pattern lein-params)) - (match-end (match-end 0))) - (list (concat (substring lein-params match-start match-end) " ") - (string-trim (substring lein-params match-end)))) - (list "" lein-params))) - (defun cider-lein-jack-in-dependencies (global-opts params dependencies dependencies-exclusions lein-plugins &optional lein-middlewares) "Create lein jack-in dependencies. Does so by concatenating GLOBAL-OPTS, DEPENDENCIES, with DEPENDENCIES-EXCLUSIONS @@ -802,16 +754,7 @@ removed, LEIN-PLUGINS, LEIN-MIDDLEWARES and finally PARAMS." `(,(concat "update-in :jvm-opts conj '\"-Djdk.attach.allowAttachSelf\"'")))) " -- ") " -- " - (if (not cider-enrich-classpath) - params - ;; enrich-classpath must be applied after the `with-profile` call, if present, - ;; so that it can also process the classpath that is typically expanded by the presence of a set of profiles: - (let* ((profiles-and-repl-call (cider--extract-lein-profiles params)) - (profiles (car profiles-and-repl-call)) - (repl-call (nth 1 profiles-and-repl-call))) - (concat profiles - "update-in :middleware conj cider.enrich-classpath.plugin-v2/middleware -- " - repl-call))))) + params)) (defun cider--dedupe-deps (deps) "Removes the duplicates in DEPS." @@ -1404,8 +1347,7 @@ With the prefix argument, allow editing of the jack in command; with a double prefix prompt for all these parameters." (interactive "P") - (let ((cider-enrich-classpath nil) ;; ensure it's disabled for cljs projects, for now - (cider-jack-in-dependencies (append cider-jack-in-dependencies cider-jack-in-cljs-dependencies)) + (let ((cider-jack-in-dependencies (append cider-jack-in-dependencies cider-jack-in-cljs-dependencies)) (cider-jack-in-lein-plugins (append cider-jack-in-lein-plugins cider-jack-in-cljs-lein-plugins)) (cider-jack-in-nrepl-middlewares (append cider-jack-in-nrepl-middlewares cider-jack-in-cljs-nrepl-middlewares)) (orig-buffer (current-buffer))) @@ -1433,8 +1375,7 @@ with a double prefix prompt for all these parameters. When SOFT-CLJS-START is non-nil, start cljs REPL only when the ClojureScript dependencies are met." (interactive "P") - (let ((cider-enrich-classpath nil) ;; ensure it's disabled for cljs projects, for now - (cider-jack-in-dependencies (append cider-jack-in-dependencies cider-jack-in-cljs-dependencies)) + (let ((cider-jack-in-dependencies (append cider-jack-in-dependencies cider-jack-in-cljs-dependencies)) (cider-jack-in-lein-plugins (append cider-jack-in-lein-plugins cider-jack-in-cljs-lein-plugins)) (cider-jack-in-nrepl-middlewares (append cider-jack-in-nrepl-middlewares cider-jack-in-cljs-nrepl-middlewares)) (orig-buffer (current-buffer))) diff --git a/clojure.sh b/clojure.sh deleted file mode 100755 index ee1d96769..000000000 --- a/clojure.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env bash -set -Eeuo pipefail -# This wrapper script adds enrich-classpath's (https://github.com/clojure-emacs/enrich-classpath) functionalities to the `clojure` binary. -# It works by accepting the `clojure` binary as the first argument, and whatever arguments you'd pass to `clojure` as the rest. -# sample usage: clojure.sh clojure -Asome-alias <<< "(System/getProperty \"java.class.path\")" - -clojure="$1" -# remove it from "$@"/"$*": -shift - -file="deps.edn" - -if [ ! -e $file ]; then - echo "$file not found." - $clojure "$@" -elif [[ "$*" == *Spath* ]]; then - echo "-Spath was passed; skipping enrich-classpath." - $clojure "$@" -elif [[ "$*" == *Scp* ]]; then - echo "-Scp was passed; skipping enrich-classpath." - $clojure "$@" -else - - here="$PWD" - there=$(mktemp -d -t mytempdir.XXXXXX) - - # copy any relevant file to the temporary folder - files_to_copy=( ".tool-versions" # asdf runtime versions configuration - ) - for file_to_copy in "${files_to_copy[@]}"; do - if [ -e "$file_to_copy" ]; then - cp "$file_to_copy" "$there" - fi - done - - # don't let local deps.edn files interfere: - cd "$there" - - # enrich-classpath will emit a command starting by "clojure", or print a stacktrace: - output=$(2>&1 "$clojure" -Sforce -Srepro -J-XX:-OmitStackTraceInFastThrow -J-Dclojure.main.report=stderr -Sdeps '{:deps {mx.cider/tools.deps.enrich-classpath {:mvn/version "1.19.3"}}}' -M -m cider.enrich-classpath.clojure "$clojure" "$here" "true" "$@") - cmd=$(tail -n1 <(echo "$output")) - - cd "$here" - - if grep --silent "^$clojure" <<< "$cmd"; then - # eval is necessary because $cmd contains arguments that have been processed through pr-str. - eval "$cmd" - else - # Print errors: - echo "$output" - $clojure "$@" - fi - -fi diff --git a/doc/modules/ROOT/pages/config/basic_config.adoc b/doc/modules/ROOT/pages/config/basic_config.adoc index c5d260462..9320da289 100644 --- a/doc/modules/ROOT/pages/config/basic_config.adoc +++ b/doc/modules/ROOT/pages/config/basic_config.adoc @@ -27,29 +27,6 @@ buffers. You can override this behavior, however: (setq cider-auto-mode nil) ---- -== Use `enrich-classpath` - -https://github.com/clojure-emacs/enrich-classpath[`enrich-classpath`] is a program/plugin/wrapper that allows CIDER to access to the sources and javadocs of a given project's Java files: your own files, those from your dependencies, and those from the JDK. - -With that, CIDER can show better completions, navigation, documentation, stacktrace and Inspector integration. - -For Lein users, it has the additional benefit of running a single JVM, instead of the two JVMs that Lein programs typically involve. - -NOTE: `enrich-classpath` is still in beta and defaults to being disabled. - -You can enable it by setting the `cider-enrich-classpath` defcustom to `t`. - -With it enabled, `cider-jack-in` will activate enrich-classpath, given the following conditions: - -* You are on macOS/Linux -* You are launching a vanilla JVM repl (and not a cljs repl, or a clj+cljs repl) -* You are using `cider-jack-in` / `cider-jack-in-clj` (and not `cider-connect`) - ** For `cider-connect`, please follow enrich-classpath's https://github.com/clojure-emacs/enrich-classpath/tree/v1.19.3#emacs-cider-connect[own instructions]. - -...these conditions will be progressively relaxed. - -It's worth noting that `cider-jack-in` will fall back to the original command if enrich-classpath failed, for whatever reason. - == Prompt for Symbol Confirmation NOTE: The default here was changed in CIDER 1.0. diff --git a/doc/modules/ROOT/pages/troubleshooting.adoc b/doc/modules/ROOT/pages/troubleshooting.adoc index 11271457a..152319206 100644 --- a/doc/modules/ROOT/pages/troubleshooting.adoc +++ b/doc/modules/ROOT/pages/troubleshooting.adoc @@ -295,35 +295,24 @@ Or by customising the jack-in options. NOTE: Leiningen disables `OmitStackTraceInFastThrow` by default. -=== Errors Related to enrich-classpath - -If you get any errors related to `enrich-classpath` when doing `cider-jack-in`, you can disable -the `enrich-classpath` integration like this: - -[source,lisp] ----- -(setq cider-enrich-classpath nil) ----- - === Navigation to JDK sources doesn't work -Firstly, make sure that you are using enrich-classpath. `cider-enrich-classpath` should be truthy. -If you are launching your own repl process, it should run through enrich-classpath's `lein` wrapper, or `clojure` wrapper. +If you try to navigate to the sources of third-party Java libraries, make sure +that the variable `cider-download-java-sources` is set to `t`. If you are on Linux and still can't navigate to the source of built-in methods like `.toUpperCase` you -probably haven't installed the JDK sources. While you're at it - it's good to -install the JDK's Javadocs as well. On Debian/Ubuntu: +probably haven't installed the JDK sources. On Debian/Ubuntu: [source,shell] ---- -$ sudo apt install openjdk-17-source openjdk-17-doc +$ sudo apt install openjdk-21-source openjdk-21-doc ---- On Red Hat/Fedora/CentOS: [source,shell] ---- -$ sudo dnf install java-17-openjdk-src java-17-openjdk-javadoc +$ sudo dnf install java-21-openjdk-src java-21-openjdk-javadoc ---- On Guix: diff --git a/lein.sh b/lein.sh deleted file mode 100755 index 028e1675a..000000000 --- a/lein.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env bash -# there's no -Ee -o pipefail, intentionally - -# This wrapper script invokes lein with the provided args (which must include the enrich-classpath middleware), -# detecting success, and invoking in return the generated `java` command. -# It falls back to lein with the same args, except that the enrich middleware will be replaced with a no-op middleware. -# By having all this logic as a .sh script (vs. inline in Elisp), we can keep using the same process/async machinery, -# which is concise and results in a non-blocking UX. - -lein="$1" -shift - -output=$(2>&1 "$lein" "$@") -cmd=$(grep "\s-cp\s"<<< "$output") - -function cache_root() { - local cache_dir="${XDG_CACHE_HOME:-$HOME/.cache}" - cache_dir="${cache_dir/#\~/$HOME}" - mkdir -p "$cache_dir" 2>/dev/null - if [[ -w "$cache_dir" ]]; then - echo "${cache_dir%/}" - else - return 1 - fi -} - -if grep --silent "\s-cp\s"<<< "$cmd"; then - eval "$cmd" -else - # Print errors: - if cache_dir=$(cache_root); then - logfile="$cache_dir"/cider-enrich-classpath-error.log - echo "$output" >> "$logfile" - echo "Could not activate enrich-classpath. Error report available at $logfile" - fi - no_enrich=() - for arg in "$@"; do - if [ "$arg" == "cider.enrich-classpath.plugin-v2/middleware" ]; then - no_enrich+=("cider.enrich-classpath.fallback/middleware") - else - no_enrich+=("$arg") - fi - done - $lein "${no_enrich[@]}" -fi diff --git a/test/cider-tests.el b/test/cider-tests.el index 5cac4d59b..44355ff71 100644 --- a/test/cider-tests.el +++ b/test/cider-tests.el @@ -147,7 +147,6 @@ (setq-local cider-injected-middleware-version "0.55.7") (setq-local cider-jack-in-nrepl-middlewares '("cider.nrepl/cider-middleware")) (setq-local cider-jack-in-dependencies-exclusions '()) - (setq-local cider-enrich-classpath t) (setq-local cider-enable-nrepl-jvmti-agent t)) (it "can inject dependencies in a lein project" @@ -156,10 +155,7 @@ (shell-quote-argument "[nrepl/nrepl \"0.9.0\"]") " -- update-in :plugins conj " (shell-quote-argument "[cider/cider-nrepl \"0.55.7\"]") - " -- update-in :plugins conj " - (shell-quote-argument "[mx.cider/lein-enrich-classpath \"1.19.3\"]") " -- update-in :jvm-opts conj '\"-Djdk.attach.allowAttachSelf\"'" - " -- update-in :middleware conj cider.enrich-classpath.plugin-v2/middleware" " -- repl :headless"))) (it "can inject dependencies in a lein project with an exclusion" @@ -170,10 +166,7 @@ (shell-quote-argument "[nrepl/nrepl \"0.9.0\" :exclusions [org.clojure/clojure]]") " -- update-in :plugins conj " (shell-quote-argument "[cider/cider-nrepl \"0.55.7\"]") - " -- update-in :plugins conj " - (shell-quote-argument "[mx.cider/lein-enrich-classpath \"1.19.3\"]") " -- update-in :jvm-opts conj '\"-Djdk.attach.allowAttachSelf\"'" - " -- update-in :middleware conj cider.enrich-classpath.plugin-v2/middleware" " -- repl :headless"))) (it "can inject dependencies in a lein project with multiple exclusions" @@ -183,10 +176,7 @@ (shell-quote-argument "[nrepl/nrepl \"0.9.0\" :exclusions [org.clojure/clojure foo.bar/baz]]") " -- update-in :plugins conj " (shell-quote-argument "[cider/cider-nrepl \"0.55.7\"]") - " -- update-in :plugins conj " - (shell-quote-argument "[mx.cider/lein-enrich-classpath \"1.19.3\"]") " -- update-in :jvm-opts conj '\"-Djdk.attach.allowAttachSelf\"'" - " -- update-in :middleware conj cider.enrich-classpath.plugin-v2/middleware" " -- repl :headless"))) (it "can inject dependencies in a gradle project" @@ -211,10 +201,7 @@ (shell-quote-argument "[refactor-nrepl \"2.0.0\"]") " -- update-in :plugins conj " (shell-quote-argument "[cider/cider-nrepl \"0.55.7\"]") - " -- update-in :plugins conj " - (shell-quote-argument "[mx.cider/lein-enrich-classpath \"1.19.3\"]") " -- update-in :jvm-opts conj '\"-Djdk.attach.allowAttachSelf\"'" - " -- update-in :middleware conj cider.enrich-classpath.plugin-v2/middleware" " -- repl :headless")))) (describe "when there are global options" @@ -230,10 +217,7 @@ (shell-quote-argument "[nrepl/nrepl \"0.9.0\"]") " -- update-in :plugins conj " (shell-quote-argument "[cider/cider-nrepl \"0.55.7\"]") - " -- update-in :plugins conj " - (shell-quote-argument "[mx.cider/lein-enrich-classpath \"1.19.3\"]") " -- update-in :jvm-opts conj '\"-Djdk.attach.allowAttachSelf\"'" - " -- update-in :middleware conj cider.enrich-classpath.plugin-v2/middleware" " -- repl :headless"))) (it "can concat in a gradle project" (expect (cider-inject-jack-in-dependencies "--no-daemon" ":clojureRepl" 'gradle) @@ -249,7 +233,6 @@ (before-each (fset 'plugins-predicate (lambda (&rest _) t)) (fset 'middlewares-predicate (lambda (&rest _) t)) - (setq-local cider-enrich-classpath nil) (setq-local cider-jack-in-lein-plugins '(("refactor-nrepl" "2.0.0" :predicate plugins-predicate))) (setq-local cider-jack-in-nrepl-middlewares '(("refactor-nrepl.middleware/wrap-refactor" :predicate middlewares-predicate) "cider.nrepl/cider-middleware" ("another/middleware")))) (it "includes plugins whose predicates return true" @@ -290,10 +273,8 @@ :and-return-value '("refactor-nrepl.middleware/wrap-refactor" "cider.nrepl/cider-middleware")) (spy-on 'cider-jack-in-normalized-lein-plugins :and-return-value '(("refactor-nrepl" "2.0.0") - ("cider/cider-nrepl" "0.55.7") - ("mx.cider/lein-enrich-classpath" "1.19.3"))) - (setq-local cider-jack-in-dependencies-exclusions '()) - (setq-local cider-enrich-classpath t)) + ("cider/cider-nrepl" "0.55.7"))) + (setq-local cider-jack-in-dependencies-exclusions '())) (it "uses them in a lein project" (expect (cider-inject-jack-in-dependencies "" "repl :headless" 'lein) :to-equal (concat "update-in :dependencies conj " @@ -302,10 +283,7 @@ (shell-quote-argument "[refactor-nrepl \"2.0.0\"]") " -- update-in :plugins conj " (shell-quote-argument "[cider/cider-nrepl \"0.55.7\"]") - " -- update-in :plugins conj " - (shell-quote-argument "[mx.cider/lein-enrich-classpath \"1.19.3\"]") " -- update-in :jvm-opts conj '\"-Djdk.attach.allowAttachSelf\"'" - " -- update-in :middleware conj cider.enrich-classpath.plugin-v2/middleware" " -- repl :headless"))))) (describe "cider-jack-in-auto-inject-clojure" @@ -669,24 +647,4 @@ (expect (cider-locate-running-nrepl-ports "from-dir") :to-equal '(("from-dir" "4567") ("lein" "1234") ("local" "2345") ("non-lein" "3456"))))) -(describe "cider--extract-lein-profiles" - (it "Splits the command by `with-profile' call, if found" - (expect (cider--extract-lein-profiles "with-profile dev repl foo bar") - :to-equal '("with-profile dev " "repl foo bar")) - - (expect (cider--extract-lein-profiles "with-profiles dev repl foo bar") - :to-equal '("with-profiles dev " "repl foo bar")) - - (expect (cider--extract-lein-profiles "with-profile +dev,+test repl foo bar") - :to-equal '("with-profile +dev,+test " "repl foo bar")) - - (expect (cider--extract-lein-profiles "with-profiles +dev,+test repl foo bar") - :to-equal '("with-profiles +dev,+test " "repl foo bar")) - - (expect (cider--extract-lein-profiles "repl") - :to-equal '("" "repl")) - - (expect (cider--extract-lein-profiles "repl :connect 1234") - :to-equal '("" "repl :connect 1234")))) - ;;; cider-tests.el ends here diff --git a/test/enrich/cider-docstring-tests.el b/test/enrich/cider-docstring-tests.el deleted file mode 100644 index ab5dcc14d..000000000 --- a/test/enrich/cider-docstring-tests.el +++ /dev/null @@ -1,78 +0,0 @@ -;; -*- lexical-binding: t; -*- - ;;; cider-docstring-tests.el - -;; Copyright © 2012-2025 Bozhidar Batsov - -;; Author: Bozhidar Batsov - -;; This file is NOT part of GNU Emacs. - -;; This program is free software: you can redistribute it and/or -;; modify it under the terms of the GNU General Public License as -;; published by the Free Software Foundation, either version 3 of the -;; License, or (at your option) any later version. -;; -;; This program is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see `http://www.gnu.org/licenses/'. - -;;; Commentary: - -;; This file is part of CIDER - -;;; Code: - -(require 'buttercup) -(require 'cider-docstring) - -;; Please, for each `describe', ensure there's an `it' block, so that its execution is visible in CI. - -(defun cider-render-docstring-test--convert-fragments (fs) - (mapcar (lambda (x) - (nrepl-dict "type" (gethash :type x) - "content" (gethash :content x))) - fs)) - -(describe "cider--render-docstring" - (it "A large corpus of fragments (as produced by Orchard) can be rendered using `shr' without raising errors" - (dolist (class '("Thread" "Object" "File" "String" "Map")) - (let* ((filename (concat default-directory - "test/" - class - ".edn")) - (_ (cl-assert (file-exists-p filename) t)) - (class-contents (with-temp-buffer - (insert-file-contents filename) - (parseedn-read-str (buffer-string))))) - (cl-assert (> (length class-contents) 0) - t) - (dotimes (i (length class-contents)) - (let* ((member (aref class-contents i))) - (cl-assert (> (hash-table-count member) 0) - t) - (gethash :doc-fragments member) - (let* ((doc-first-sentence-fragments (cider-render-docstring-test--convert-fragments - (gethash :doc-first-sentence-fragments member))) - (eldoc-info (list "doc-fragments" (cider-render-docstring-test--convert-fragments - (gethash :doc-fragments member)) - "doc-first-sentence-fragments" doc-first-sentence-fragments - "doc-block-tags-fragments" (cider-render-docstring-test--convert-fragments - (gethash :doc-block-tags-fragments member)))) - (result (cider--render-docstring eldoc-info))) - (cl-assert (stringp result) t (prin1-to-string eldoc-info)) - (expect (stringp result) - :to-be-truthy) - (expect (> (length result) 0) - :to-be-truthy) - (when (> (length doc-first-sentence-fragments) - 0) - (let ((result (cider--render-docstring (list "doc-first-sentence-fragments" doc-first-sentence-fragments)))) - (cl-assert (stringp result) t (prin1-to-string doc-first-sentence-fragments)) - (expect (stringp result) - :to-be-truthy) - (expect (> (length result) 0) - :to-be-truthy))))))))))