add benchmark bindings (,tbs and ,tba)
go supports running benchmarks much similar to running tests, the new key bindings will run single or all benchmark
This commit is contained in:
parent
01aadd8900
commit
7fe392d946
2 changed files with 19 additions and 2 deletions
|
@ -41,6 +41,21 @@
|
|||
(+go--run-tests (concat "-run" "='" (match-string-no-properties 2) "'")))
|
||||
(error "Must be in a _test.go file")))
|
||||
|
||||
;;;###autoload
|
||||
(defun +go/bench-all ()
|
||||
(interactive)
|
||||
(+go--run-tests "-test.run=NONE -test.bench=\".*\""))
|
||||
|
||||
;;;###autoload
|
||||
(defun +go/bench-single ()
|
||||
(interactive)
|
||||
(if (string-match "_test\\.go" buffer-file-name)
|
||||
(save-excursion
|
||||
(re-search-backward "^func[ ]+\\(([[:alnum:]]*?[ ]?[*]?[[:alnum:]]+)[ ]+\\)?\\(Benchmark[[:alnum:]_]+\\)(.*)")
|
||||
(+go--run-tests (concat "-test.run=NONE -test.bench" "='" (match-string-no-properties 2) "'")))
|
||||
(error "Must be in a _test.go file")))
|
||||
|
||||
|
||||
;;;###autoload
|
||||
(defun +go/play-buffer-or-region (&optional beg end)
|
||||
"TODO"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue