Last active
July 23, 2021 17:48
-
-
Save psanford/d175c10ca28b1566de358fe336a9fb2f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defun pms-go-run-test (&optional more-test-args) | |
| "Runs tests for current package" | |
| (interactive) | |
| (when (buffer-file-name) | |
| (save-buffer)) | |
| (compile (concat "go test -v -count=1 -mod=mod" more-test-args) 'go-compilation) | |
| (ring-insert pms-previous-test-ring | |
| (cons | |
| `(lambda () (pms-go-run-test ,more-test-args)) | |
| (current-buffer)))) | |
| (defun pms-go-single-test-function (&optional more-test-args) | |
| "Runs the current test function only" | |
| (interactive) | |
| (save-excursion | |
| (let ((func-name (go--function-name))) | |
| (when (not (string-prefix-p "Test" func-name)) | |
| (error "Not in a test function: %s" func-name)) | |
| (compile (concat "go test -v -count=1 -mod=mod -run ^" func-name "$" more-test-args) 'go-compilation) | |
| (ring-insert pms-previous-test-ring | |
| (cons | |
| `(lambda () (pms-go-run-test ,more-test-args)) | |
| (current-buffer)))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment