Skip to content

Commit 4820cf5

Browse files
Use flycheck-fsharp--can-make-request-p instead of lambda expression
This allows flet mocking in tests. Refs #167
1 parent 69585d4 commit 4820cf5

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

flycheck-fsharp.el

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434

3535
(defvar flycheck-fsharp--lint-callback-info nil)
3636

37+
(defun flycheck-fsharp--can-make-request-p ()
38+
(fsharp-ac-can-make-request t))
39+
3740
(defun flycheck-fsharp-fsautocomplete-lint-start (checker callback)
3841
"Start a F# syntax check with CHECKER.
3942
CALLBACK is the status callback passed by Flycheck."
@@ -48,7 +51,7 @@ CALLBACK is the status callback passed by Flycheck."
4851
"A syntax checker for F# using FSharp.AutoComplete.
4952
See URL `https://github.com/fsharp/FsAutoComplete'."
5053
:start #'flycheck-fsharp-fsautocomplete-lint-start
51-
:predicate (lambda () (fsharp-ac-can-make-request t))
54+
:predicate #'flycheck-fsharp--can-make-request-p
5255
:modes '(fsharp-mode))
5356

5457
(defvar flycheck-fsharp--error-callback-info nil)
@@ -64,7 +67,7 @@ CALLBACK is the status callback passed by Flycheck."
6467
See URL `https://github.com/fsharp/FsAutoComplete'."
6568
:start #'flycheck-fsharp-fsautocomplete-start
6669
:modes '(fsharp-mode)
67-
:predicate (lambda () (fsharp-ac-can-make-request t))
70+
:predicate #'flycheck-fsharp--can-make-request-p
6871
:next-checkers '((info . fsharp-fsautocomplete-lint)))
6972

7073
(defun flycheck-fsharp-handle-lint (data)

test/test-common.el

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
(defmacro stubbing-process-functions (&rest body)
3030
`(noflet ((process-live-p (p) t)
3131
(fsharp-ac--process-live-p (host) t)
32+
(flycheck-fsharp--can-make-request-p () t)
3233
(start-process (&rest args))
3334
(set-process-filter (&rest args))
3435
(set-process-query-on-exit-flag (&rest args))

0 commit comments

Comments
 (0)