diff --git a/extensions/elixir/languages/elixir/runnables.scm b/extensions/elixir/languages/elixir/runnables.scm new file mode 100644 index 0000000000..13dc860586 --- /dev/null +++ b/extensions/elixir/languages/elixir/runnables.scm @@ -0,0 +1,20 @@ +; Macros `describe` and `test`. +; This matches the ExUnit test style. +( + (call + target: (identifier) @run (#any-of? @run "describe" "test") + ) @_elixir-test + (#set! tag elixir-test) +) + +; Modules containing at least one `describe` or `test`. +; This matches the ExUnit test style. +( + (call + target: (identifier) @run (#eq? @run "defmodule") + (do_block + (call target: (identifier) @_keyword (#any-of? @_keyword "describe" "test")) + ) + ) @_elixir-module-test + (#set! tag elixir-module-test) +) diff --git a/extensions/elixir/languages/elixir/tasks.json b/extensions/elixir/languages/elixir/tasks.json index e1db25cd37..d5026f0034 100644 --- a/extensions/elixir/languages/elixir/tasks.json +++ b/extensions/elixir/languages/elixir/tasks.json @@ -13,12 +13,14 @@ { "label": "mix test $ZED_RELATIVE_FILE", "command": "mix", - "args": ["test", "$ZED_RELATIVE_FILE"] + "args": ["test", "$ZED_RELATIVE_FILE"], + "tags": ["elixir-module-test"] }, { "label": "mix test $ZED_RELATIVE_FILE:$ZED_ROW", "command": "mix", - "args": ["test", "$ZED_RELATIVE_FILE:$ZED_ROW"] + "args": ["test", "$ZED_RELATIVE_FILE:$ZED_ROW"], + "tags": ["elixir-test"] }, { "label": "Elixir: break line",