-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update pattern to capture the function name as @_name
- Loading branch information
Showing
1 changed file
with
8 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
; Functions names start with `Test` | ||
( | ||
(function_declaration name: (_) @run | ||
(#match? @run "^Test.+")) | ||
(function_declaration name: (_) @run @_name | ||
(#match? @_name "^Test.+")) | ||
) @go-test | ||
|
||
; `t.Run` | ||
( | ||
(call_expression function: (_) @run | ||
(#match? @run "^t.Run.*")) | ||
(call_expression function: (_) @run @_name | ||
(#match? @_name "^t.Run.*")) | ||
) @go-subtest | ||
|
||
; Functions names start with `Benchmark` | ||
( | ||
(function_declaration name: (_) @run | ||
(#match? @run "^Benchmark.+")) | ||
(function_declaration name: (_) @run @_name | ||
(#match? @_name "^Benchmark.+")) | ||
) @go-benchmark | ||
|
||
; go run | ||
( | ||
(function_declaration name: (_) @run | ||
(#match? @run "^main$")) | ||
(function_declaration name: (_) @run @_name | ||
(#match? @_name "^main$")) | ||
) @go-run |