Skip to content

Commit

Permalink
error to user-error and gets tests working
Browse files Browse the repository at this point in the history
  • Loading branch information
dickmao committed Mar 30, 2022
1 parent 3b134fa commit 57eb1ba
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
id: cache-local-bin
with:
path: $HOME/.local/bin
key: cache-local-bin-000
key: cache-local-bin-001

- uses: actions/cache@v2
id: cache-cask-executable
Expand Down
7 changes: 3 additions & 4 deletions private-comments-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,7 @@ numerical port, e.g., 5749, which assumes
(unless (ping 1)
(if (y-or-n-p "PC Server not running. Run now? ")
(private-comments--run-server)
(let (debug-on-error)
(error "`private-comments-ensure-server': quit"))))
(user-error "`private-comments-ensure-server': quit")))
(unless (ping 5)
(error "`private-comments-ensure-server': could not start server"))))

Expand Down Expand Up @@ -435,7 +434,7 @@ An uncommitted change cannot be privately commented."
#'private-comments--generic-callback
(current-buffer))
nil t)
(error "No private comment found")))
(user-error "No private comment found")))

(defsubst private-comments--uncommitted (commit)
"Predicate whether COMMIT hash is committed."
Expand All @@ -455,7 +454,7 @@ An uncommitted change cannot be privately commented."
(aref blame-data line-number)))
(commit (plist-get blame :commit)))
(if (private-comments--uncommitted commit)
(error "Line %s is uncommitted" line-number)
(user-error "Line %s is uncommitted" line-number)
(private-comments-edit
(apply-partially #'private-comments--edit-callback-4
(current-buffer)
Expand Down
9 changes: 9 additions & 0 deletions tests/private-comments-mode-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@
(setenv "PRIVATE_COMMENTS_PORT"
(number-to-string (url-port (url-generic-parse-url private-comments-url))))

(when (getenv "CI")
(cl-assert
(zerop
(apply #'call-process "git" nil nil nil
(split-string "config --global user.email foo@example.com"))))
(cl-assert
(zerop (apply #'call-process "git" nil nil nil
(split-string "config --global user.name his_fooness")))))

(defun pcm-test-wait-for (predicate &optional predargs ms interval continue)
"Wait until PREDICATE function returns non-`nil'.
PREDARGS is argument list for the PREDICATE function.
Expand Down

0 comments on commit 57eb1ba

Please sign in to comment.