This is a hacky way to run tests, but it will do for now

This commit is contained in:
Benson Chu 2023-02-27 20:36:55 -06:00
parent 7826be40d3
commit afa2f3f98e
3 changed files with 68 additions and 28 deletions

View file

@ -69,35 +69,12 @@
;; (defvar gac-auto-merge-branch-list nil) ;; (defvar gac-auto-merge-branch-list nil)
;; (make-variable-buffer-local 'gac-auto-merge-branch-list) ;; (make-variable-buffer-local 'gac-auto-merge-branch-list)
(when my/puppet-p
(add-to-list 'emacs-startup-hook
#'(lambda ()
(run-at-time 30 300 #'gaff/trigger)))
(add-hook 'emacs-startup-hook
#'gac-run-ssh-add)
(add-hook 'emacs-startup-hook
#'keychain-refresh-environment))
(defun-cached 60 gac-run-gaff () (defun-cached 60 gac-run-gaff ()
(gaff/trigger)) (gaff/trigger))
(defun-cached 15 gac-run-ssh-add () (defun-cached 15 gac-run-ssh-add ()
(rb/ssh-add)) (rb/ssh-add))
(add-hook 'git-auto-commit-mode-hook
#'gac-run-gaff)
(add-hook 'git-auto-commit-mode-hook
#'gac-after-save-func t t)
(add-hook 'git-auto-commit-mode-hook
#'gac-run-ssh-add)
(add-hook 'git-auto-commit-mode-hook
#'keychain-refresh-environment)
(add-to-list 'safe-local-variable-values (add-to-list 'safe-local-variable-values
'(gac-automatically-push-p . t)) '(gac-automatically-push-p . t))
@ -180,8 +157,33 @@
(timer-event-handler timer)) (timer-event-handler timer))
(remhash k gac--debounce-timers))) (remhash k gac--debounce-timers)))
(add-hook 'kill-emacs-hook
'gac-activate-all-timers) (when (not noninteractive)
(when my/puppet-p
(add-to-list 'emacs-startup-hook
#'(lambda ()
(run-at-time 30 300 #'gaff/trigger)))
(add-hook 'emacs-startup-hook
#'gac-run-ssh-add)
(add-hook 'emacs-startup-hook
#'keychain-refresh-environment))
(add-hook 'git-auto-commit-mode-hook
#'gac-run-gaff)
(add-hook 'git-auto-commit-mode-hook
#'gac-after-save-func t t)
(add-hook 'git-auto-commit-mode-hook
#'gac-run-ssh-add)
(add-hook 'git-auto-commit-mode-hook
#'keychain-refresh-environment)
(add-hook 'kill-emacs-hook
'gac-activate-all-timers))
;; (add-hook 'gaff/after-merge-hook ;; (add-hook 'gaff/after-merge-hook
;; (lambda () ;; (lambda ()

36
run-tests.el Normal file
View file

@ -0,0 +1,36 @@
;;; run-tests.el --- -*- lexical-binding: t -*-
;; Copyright (C) 2023 Benson Chu
;; Author: Benson Chu <bensonchu457@gmail.com>
;; Created: [2023-02-27 20:26]
;; This file is not part of GNU Emacs
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;;; Code:
(message "Loading Emacs config...")
(let ((inhibit-message t))
(load (expand-file-name "init.el"
user-emacs-directory)))
(message "Running tests...")
(load (expand-file-name "tests/my-org-tests.el"
user-emacs-directory))
(provide 'run-tests)
;;; run-tests.el ends here

View file

@ -10,7 +10,8 @@
(buffer-gensym (gensym "buffer"))) (buffer-gensym (gensym "buffer")))
`(progn `(progn
,@(save-window-excursion ,@(save-window-excursion
(let ((buffer (find-file-noselect file))) (let ((inhibit-message t)
(buffer (find-file-noselect file)))
(prog1 (with-current-buffer buffer (prog1 (with-current-buffer buffer
(beginning-of-buffer) (beginning-of-buffer)
(when (not (org-at-heading-p)) (when (not (org-at-heading-p))
@ -36,7 +37,8 @@
(buffer-gensym (gensym "buffer"))) (buffer-gensym (gensym "buffer")))
`(progn `(progn
,@(save-window-excursion ,@(save-window-excursion
(let ((buffer (find-file-noselect file))) (let ((buffer (find-file-noselect file))
(inhibit-message t))
(prog1 (with-current-buffer buffer (prog1 (with-current-buffer buffer
(beginning-of-buffer) (beginning-of-buffer)
(when (not (org-at-heading-p)) (when (not (org-at-heading-p))
@ -107,4 +109,4 @@
(ert-run-tests-interactively t) (ert-run-tests-interactively t)
;; (progn (setq org-disabled-tests nil) (mapcar (lambda (sym) (put sym 'ert--test nil)) (apropos-internal "" #'ert-test-boundp))) ;; (progn (setq org-disabled-tests nil) (mapcar (lambda (sym) (put sym 'ert--test nil)) (apropos-internal "" #'ert-test-boundp))))