Skip to content

Commit 98ac99a

Browse files
committed
Fix windows CI failure on xref fallback tests
GitHub windows runners set TEMP to a DOS 8.3 short path (RUNNER~1) while locations are built from buffer-file-name, which holds the resolved long name, so build the expected URIs from the visiting buffer's file name instead of the raw temp path.
1 parent fa2703b commit 98ac99a

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

‎test/eca-editor-test.el‎

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,15 @@
259259
(expect (plist-get lsp-params :context)
260260
:to-equal '(:includeDeclaration :json-false)))))
261261

262+
(defun eca-editor-test--buffer-file-uri ()
263+
"URI of `eca-editor-test--file' from its visiting buffer.
264+
Location URIs are built from the variable `buffer-file-name',
265+
which on Windows holds the resolved long path while
266+
`make-temp-file' may return a DOS 8.3 short name (e.g. RUNNER~1),
267+
so expected URIs must come from the same source."
268+
(eca--path-to-uri
269+
(buffer-file-name (find-buffer-visiting eca-editor-test--file))))
270+
262271
;; A fake xref backend answering fixed locations inside the temp file:
263272
;; the declaration at line 1 column 6 and a usage at line 2 column 2.
264273
(cl-defmethod xref-backend-identifier-at-point ((_backend (eql eca-editor-test--xref)))
@@ -304,7 +313,7 @@
304313
session request
305314
(list :status "success"
306315
:locations (vector
307-
(list :uri (eca--path-to-uri eca-editor-test--file)
316+
(list :uri (eca-editor-test--buffer-file-uri)
308317
:range (list :start (list :line 1 :character 7)
309318
:end (list :line 1 :character 7)))))))
310319

@@ -316,10 +325,10 @@
316325
session request
317326
(list :status "success"
318327
:locations (vector
319-
(list :uri (eca--path-to-uri eca-editor-test--file)
328+
(list :uri (eca-editor-test--buffer-file-uri)
320329
:range (list :start (list :line 1 :character 7)
321330
:end (list :line 1 :character 7)))
322-
(list :uri (eca--path-to-uri eca-editor-test--file)
331+
(list :uri (eca-editor-test--buffer-file-uri)
323332
:range (list :start (list :line 2 :character 3)
324333
:end (list :line 2 :character 3)))))))
325334

@@ -333,7 +342,7 @@
333342
session request
334343
(list :status "success"
335344
:locations (vector
336-
(list :uri (eca--path-to-uri eca-editor-test--file)
345+
(list :uri (eca-editor-test--buffer-file-uri)
337346
:range (list :start (list :line 2 :character 3)
338347
:end (list :line 2 :character 3)))))))
339348

0 commit comments

Comments
 (0)