diff --git a/lua/dap-go-ts.lua b/lua/dap-go-ts.lua index 1af89ca..f3c1526 100644 --- a/lua/dap-go-ts.lua +++ b/lua/dap-go-ts.lua @@ -17,7 +17,10 @@ local subtests_query = [[ field: (field_identifier) @run) arguments: (argument_list (interpreted_string_literal) @testname - (func_literal)) + [ + (func_literal) + (identifier) + ]) (#eq? @run "Run")) @parent ]] diff --git a/tests/go.mod b/tests/go.mod new file mode 100644 index 0000000..ce0eeb2 --- /dev/null +++ b/tests/go.mod @@ -0,0 +1,3 @@ +module github.com/leoluz/nvim-dap-go + +go 1.22.2 diff --git a/tests/subtest_bar_test.go b/tests/subtest_bar_test.go new file mode 100644 index 0000000..6627856 --- /dev/null +++ b/tests/subtest_bar_test.go @@ -0,0 +1,12 @@ +package tests + +import ( + "testing" +) + +// https://github.com/leoluz/nvim-dap-go/pull/82 +func TestWithSubTests(t *testing.T) { + t.Run("subtest with function literal", func(t *testing.T) { t.Fail() }) + myFunc := func(t *testing.T) { t.FailNow() } + t.Run("subtest with identifier", myFunc) +}