Skip to content

Commit

Permalink
Update pattern to capture the function name as @_name
Browse files Browse the repository at this point in the history
  • Loading branch information
anilsenay committed May 21, 2024
1 parent 2cc7d94 commit f48f6b5
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions crates/languages/src/go/runnables.scm
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

0 comments on commit f48f6b5

Please sign in to comment.