Add unit test for mgr-gitlab-clone, run in CI
This commit is contained in:
@@ -45,12 +45,12 @@
|
|||||||
|
|
||||||
(defun mgr-gitlab-clone (name)
|
(defun mgr-gitlab-clone (name)
|
||||||
"Clone the project NAME."
|
"Clone the project NAME."
|
||||||
;; TODO: Automatically set remote.pushDefault so it does not prompt
|
|
||||||
;; TODO: Clone with API token, if there is one
|
;; TODO: Clone with API token, if there is one
|
||||||
(interactive
|
(interactive
|
||||||
(list (completing-read "Project: " (mgr-gitlab-list-remote-project-names))))
|
(list (completing-read "Project: " (mgr-gitlab-list-remote-project-names))))
|
||||||
(let* ((url (mgr-gitlab--get-url-by-name name))
|
(let* ((url (mgr-gitlab--get-url-by-name name))
|
||||||
(dest mgr-gitlab-project-path))
|
(dest mgr-gitlab-project-path))
|
||||||
|
(setf magit-clone-set-remote.pushDefault t)
|
||||||
(magit-clone-regular url dest nil)))
|
(magit-clone-regular url dest nil)))
|
||||||
|
|
||||||
(defun mgr-gitlab-clone-all ()
|
(defun mgr-gitlab-clone-all ()
|
||||||
@@ -92,4 +92,8 @@ gitlab so kindly removes."
|
|||||||
|
|
||||||
(add-to-list 'dashboard-item-generators '(mgr-gitlab-gitlab-projects . mgr-gitlab-dashboard-insert-gitlab-projects))
|
(add-to-list 'dashboard-item-generators '(mgr-gitlab-gitlab-projects . mgr-gitlab-dashboard-insert-gitlab-projects))
|
||||||
|
|
||||||
|
(ert-deftest mgr-gitlab-clone-test ()
|
||||||
|
"Tests that mgr-gitlab can clone a repo"
|
||||||
|
(mgr-gitlab-clone "IotButton"))
|
||||||
|
|
||||||
(provide 'mgr-gitlab)
|
(provide 'mgr-gitlab)
|
||||||
|
|||||||
10
.mgr_config/tests/gitlab-utils.sh
Normal file
10
.mgr_config/tests/gitlab-utils.sh
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
gitlab_start_log_section() {
|
||||||
|
NAME="$1"
|
||||||
|
HEADER="2"
|
||||||
|
echo -e "\e[0Ksection_start:`date +%s`:${NAME}\r\e[0K${HEADER}"
|
||||||
|
}
|
||||||
|
|
||||||
|
gitlab_end_log_section() {
|
||||||
|
NAME="$1"
|
||||||
|
echo -e "\e[0Ksection_start:`date +%s`:${NAME}\r\e[0K${HEADER}"
|
||||||
|
}
|
||||||
@@ -1,3 +1,17 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
emacs --batch --debug-init --load ./.emacs.d/init.el
|
set -e -o pipefail
|
||||||
|
|
||||||
|
SRC_ROOT="$(dirname "${BASH_SOURCE}")"
|
||||||
|
|
||||||
|
source "$SRC_ROOT/gitlab-utils.sh"
|
||||||
|
|
||||||
|
# Load emacs
|
||||||
|
gitlab_start_log_section "test_init" "Running Emacs"
|
||||||
|
emacs --batch --debug-init -l ./.emacs.d/init.el
|
||||||
|
gitlab_end_log_section "test_init"
|
||||||
|
|
||||||
|
# Run tests
|
||||||
|
gitlab_start_log_section "run_unit_tests" "Running Unit Tests"
|
||||||
|
emacs --batch --debug-init -l ert -l ./.emacs.d/init.el -f ert-run-tests-batch-and-exit
|
||||||
|
gitlab_end_log_section "run_unit_tests"
|
||||||
|
|||||||
Reference in New Issue
Block a user