support underscores in Go test functions
When trying to run a single test function with LEADER m t t in a Golang test file, spacemacs failed to find functions which had underscores in their names. This commit simply adds an underscore to the regular expression which spacemacs uses when searching for the current test function.
This commit is contained in:
parent
190962bc4b
commit
f0f2034a53
|
@ -50,7 +50,7 @@
|
|||
"-check.f"
|
||||
"-run")))
|
||||
(save-excursion
|
||||
(re-search-backward "^func[ ]+\\(([[:alnum:]]*?[ ]?[*]?[[:alnum:]]+)[ ]+\\)?\\(Test[[:alnum:]]+\\)(.*)")
|
||||
(re-search-backward "^func[ ]+\\(([[:alnum:]]*?[ ]?[*]?[[:alnum:]]+)[ ]+\\)?\\(Test[[:alnum:]_]+\\)(.*)")
|
||||
(spacemacs/go-run-tests (concat test-method "='" (match-string-no-properties 2) "'"))))
|
||||
(message "Must be in a _test.go file to run go-run-test-current-function")))
|
||||
|
||||
|
@ -59,7 +59,7 @@
|
|||
(if (string-match "_test\.go" buffer-file-name)
|
||||
(if go-use-gocheck-for-testing
|
||||
(save-excursion
|
||||
(re-search-backward "^func[ ]+\\(([[:alnum:]]*?[ ]?[*]?\\([[:alnum:]]+\\))[ ]+\\)?Test[[:alnum:]]+(.*)")
|
||||
(re-search-backward "^func[ ]+\\(([[:alnum:]]*?[ ]?[*]?\\([[:alnum:]]+\\))[ ]+\\)?Test[[:alnum:]_]+(.*)")
|
||||
(spacemacs/go-run-tests (concat "-check.f='" (match-string-no-properties 2) "'")))
|
||||
(message "Gocheck is needed to test the current suite"))
|
||||
(message "Must be in a _test.go file to run go-test-current-suite")))
|
||||
|
|
Loading…
Reference in a new issue