Skip to content

Commit faf021a

Browse files
Merge pull request #304 from juergenhoetzel/improve-integration-tests
Also install specific version in integration tests
2 parents 4278c5f + 7be32c0 commit faf021a

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

eglot-fsharp.el

+8-8
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@
8787
(seq-some (lambda (s) (and (string-match "^fsautocomplete[[:space:]]+\\([0-9\.]*\\)[[:space:]]+" s) (match-string 1 s)))
8888
(process-lines "dotnet" "tool" "list" "--tool-path" (file-name-directory (eglot-fsharp--path-to-server)))))
8989

90-
(defun eglot-fsharp-current-version-p ()
90+
(defun eglot-fsharp-current-version-p (version)
9191
"Return t if the installation is not outdated."
9292
(when (file-exists-p (eglot-fsharp--path-to-server))
93-
(if (eq eglot-fsharp-server-version 'latest)
93+
(if (eq version 'latest)
9494
(equal (eglot-fsharp--latest-version)
9595
(eglot-fsharp--installed-version))
9696
(equal eglot-fsharp-server-version (eglot-fsharp--installed-version)))))
@@ -108,7 +108,7 @@
108108
(version<= emacs-version "26.2"))
109109
"NORMAL:-VERS-TLS1.3"
110110
gnutls-algorithm-priority))))
111-
(unless (eglot-fsharp-current-version-p)
111+
(unless (eglot-fsharp-current-version-p version)
112112
(url-copy-file url zip t)
113113
;; FIXME: Windows (unzip preinstalled?)
114114
(let ((default-directory (file-name-directory (eglot-fsharp--path-to-server))))
@@ -133,7 +133,7 @@
133133
(defun eglot-fsharp--install-core (version)
134134
"Download and install fsautocomplete as a dotnet tool at version VERSION in `eglot-fsharp-server-install-dir'."
135135
(let ((default-directory (file-name-directory (eglot-fsharp--path-to-server))))
136-
(unless (eglot-fsharp-current-version-p)
136+
(unless (eglot-fsharp-current-version-p version)
137137
(if (file-exists-p (eglot-fsharp--path-to-server))
138138
(eglot-fsharp--process-tool-action (call-process "dotnet" nil '(nil
139139
"error_output.txt")
@@ -145,12 +145,12 @@
145145
"--tool-path" default-directory "--version"
146146
version)))))
147147

148-
(defun eglot-fsharp--maybe-install ()
148+
(defun eglot-fsharp--maybe-install (&optional version)
149149
"Downloads F# compiler service, and install in `eglot-fsharp-server-install-dir'."
150150
(make-directory (file-name-directory (eglot-fsharp--path-to-server)) t)
151-
(let* ((version (if (eq eglot-fsharp-server-version 'latest)
152-
(eglot-fsharp--latest-version)
153-
eglot-fsharp-server-version)))
151+
(let* ((version (or version (if (eq eglot-fsharp-server-version 'latest)
152+
(eglot-fsharp--latest-version)
153+
eglot-fsharp-server-version))))
154154
(if (eq eglot-fsharp-server-runtime 'net-core)
155155
(eglot-fsharp--install-core version)
156156
(eglot-fsharp--install-w32 version))))

test/integration-tests.el

+3
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@
3737
(string-suffix-p file-name-suffix (plist-get params :uri))))))
3838

3939
(describe "F# LSP server"
40+
(it "can be installed @version 0.52.0"
41+
(eglot-fsharp--maybe-install "0.52.0")
42+
(expect (eglot-fsharp--installed-version) :to-equal "0.52.0"))
4043
(it "Can be installed"
4144
(eglot-fsharp--maybe-install)
4245
(expect (eglot-fsharp--installed-version) :to-equal (eglot-fsharp--latest-version)))

0 commit comments

Comments
 (0)