Skip to content

Commit

Permalink
rustic-test-babel-spinner: add more test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
brotzeit committed Sep 7, 2018
1 parent 6c3ccd3 commit 757ec39
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
6 changes: 4 additions & 2 deletions rustic-babel.el
Original file line number Diff line number Diff line change
Expand Up @@ -150,17 +150,19 @@ execution with rustfmt."
(with-current-buffer proc-buffer
(setq result (buffer-string)))
(rustic-babel-update-result-block result)
(with-rustic-spinner rustic-babel-spinner nil nil)
(kill-buffer proc-buffer))
(progn
(with-current-buffer proc-buffer
(setq result
(car (split-string
(buffer-substring-no-properties (point-min) (point-max)) "\n" ))))
(rustic-babel-update-result-block result)
(pop-to-buffer proc-buffer)))
(with-rustic-spinner rustic-babel-spinner nil nil)))
(with-rustic-spinner rustic-babel-spinner nil nil)
(pop-to-buffer proc-buffer)))))

(defun rustic-babel-update-result-block (result)
"Update result block with RESULT."
(let ((marker rustic-babel-src-location)
(result-params (list (cdr (assq :results rustic-babel-params)))))
(with-current-buffer (marker-buffer marker)
Expand Down
19 changes: 18 additions & 1 deletion test/rustic-babel-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,24 @@
(should (spinner-p rustic-babel-spinner))
(should-not (eq mode-line-process nil))
(goto-char (point-min))
(sit-for 0.1)))))
(sit-for 0.1))))
;; check if spinner stops in case of build error
(let* ((string "fn main() {")
(buf (rustic-test-get-babel-block string)))
(with-current-buffer buf
(rustic-test-babel-execute-block buf)
(should-not (spinner-p rustic-babel-spinner))
(should (eq mode-line-process nil))))
;; check if spinner stops in case of thread panic
(let* ((string " fn main() {
let v = vec![1, 2, 3];
v[99];
}")
(buf (rustic-test-get-babel-block string)))
(with-current-buffer buf
(rustic-test-babel-execute-block buf)
(should-not (spinner-p rustic-babel-spinner))
(should (eq mode-line-process nil)))))

(ert-deftest rustic-test-babel-format ()
(let* ((string "fn main() {}")
Expand Down

0 comments on commit 757ec39

Please sign in to comment.