Skip to content
This repository has been archived by the owner on Nov 23, 2021. It is now read-only.

Commit

Permalink
tests still not running
Browse files Browse the repository at this point in the history
  • Loading branch information
gdkrmr committed Jul 29, 2017
1 parent 6207034 commit 8c476b3
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 27 deletions.
3 changes: 1 addition & 2 deletions flycheck-julia.el
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,7 @@ CHECKER is 'julia-linter, this is a flycheck internal."
("ignore_warnings" . ,json-false)
("show_code" . t)))))
;; return immediately without any errors, leave that to the sentinel
(if np (process-send-string np js)
(funcall callback 'interrupted))))
(if np (process-send-string np js) (funcall callback 'interrupted))))

(defun flycheck-julia-error-parser (errors checker buffer)
"Parse the error returned from the Julia lint server.
Expand Down
80 changes: 55 additions & 25 deletions test/flycheck-julia-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,20 @@
;;; Code:


(require 'flycheck)
(require 'flycheck-julia)
(require 'flycheck-ert)

(load "ess-autoloads.el")
(require 'ess-site)
(flycheck-julia-setup)
(setq flycheck-julia-port 3457)

(ert-deftest flycheck-julia-start-server ()
:tags '(server)
(flycheck-julia-server-start)
(should (flycheck-julia-server-p))
(flycheck-julia-server-stop)
(flycheck- julia-server-stop)
(sleep-for 5)
(kill-buffer "*julia-linter*"))

Expand All @@ -62,37 +65,64 @@
(sleep-for 5)
(kill-buffer "*julia-linter*"))

;; Lint.jl does extensive testing on the correctness of errors, so we only check
;; that querying the server actually works.
(ert-deftest flycheck-julia-test-query ()
:tags '(query)
(setq flycheck-julia-max-tries 20000)
(flycheck-julia-server-start)
(sleep-for 5)
(ert-deftest flycheck-julia-test-all ()
(with-temp-buffer
(ess-julia-mode)
(flycheck-mode)
(sleep-for 5)
(print (flycheck-may-enable-checker 'flycheck-julia))
(print flycheck-enabled-checkers)
(flycheck- select-checker 'flycheck-julia)
(print (flycheck-may-use-checker 'flycheck-julia))
(insert-string "\ny\n")

(message "test 0")
(print (flycheck-julia-server-query 'flycheck-julia))
(flycheck-buffer)
(sleep-for 5)
;; Seeping causes the network process to close the connection
;; Fails, because process is already dead
(message "test 1")
(print (flycheck-julia-server-query 'flycheck-julia))

(print flycheck-current-errors)
(flycheck-buffer)
(sleep-for 5)
(setq tmp-res nil)
(message "test 2")
(setq tmp-res (flycheck-julia-server-query 'flycheck-julia))
(message "test 3")
(print tmp-res)
(should (cl-search "undeclared symbol" (aref (nth 0 tmp-res) 6))))
;; cleanup
(sleep-for 5)
(flycheck-julia-server-stop)
(print flycheck-current-errors)
(sleep-for 5)
(print flycheck-current-errors)
(sleep-for 5)
(print flycheck-current-errors)
(sleep-for 5)
(print flycheck-current-errors)
(should (flycheck-julia-server-p))
)
(sleep-for 5)
(kill-buffer "*julia-linter*"))

;; Lint.jl does extensive testing on the correctness of errors, so we only check
;; that querying the server actually works.
;; (ert-deftest flycheck-julia-test-query ()
;; :tags '(query)
;; (flycheck-julia-server-start)
;; (sleep-for 5)
;; (with-temp-buffer
;; (insert-string "\ny\n")
;; (ess-julia-mode)
;; (flycheck-mode)
;; (sleep-for 15)

;; (message "test 0")
;; (flycheck-buffer)
;; (print flycheck-current-errors)
;; (sleep-for 15)
;; (print flycheck-current-errors)
;; ;; Seeping causes the network process to close the connection
;; ;; Fails, because process is already dead
;; (message "test 1")
;; (flycheck-buffer)
;; (print flycheck-current-errors)
;; (sleep-for 15)
;; (print flycheck-current-errors)
;; (should (cl-search "undeclared symbol" (aref (nth 0 flycheck-current-errors) 6))))
;; ;; cleanup
;; (sleep-for 5)
;; (flycheck-julia-server-stop)
;; (sleep-for 5)
;; (kill-buffer "*julia-linter*"))

(provide 'flycheck-julia-test)

;;; flycheck-julia-test.el ends here

0 comments on commit 8c476b3

Please sign in to comment.