Skip to content

go: cannot run subtests that has bracket or parentheses in name #42347

@RafatRashid

Description

@RafatRashid

Summary

Cannot run go subtests that has bracket or parentheses in name

Description

For subtests in GO, if the name has brackets - [] OR parentheses - (), running the subtest from play button, the test results into testing: warning: no tests to run output

However if I run the actual test from play button, the test runs properly

Steps to reproduce:

  1. Create a subtest under a test with brackets in name. For example -
func TestInventoryCheckout(t *testing.T) {
	t.Run("[Single] customer can checkout", func(t *testing.T) {
		slog.Info(`💡 cart items left after checkout of customer A - `, slog.Any("orderItems", orderItems.Items))
	})
  1. Press play button beside of t.Run, then select go test ......

Expected Behavior: Should run the test properly and show proper test output
Actual Behavior: Outputting testing: warning: no tests to run as below -
Image

PS -

  • My settings.json and keymap.json does not have any language related changes and I dont have any .editorconfig for this project.
  • The same subtest works properly if debug. Here is a shot for that -
Image - Also pressing play button beside `func TestInventoryCheckout(t *testing.T) {` then selecting `go test .....` results into proper output as shown below - Image

Zed Version and System Specs

Zed: v0.211.6 (Zed)
OS: macOS 15.7.2
Memory: 18 GiB
Architecture: aarch64

If applicable, attach your Zed.log file to this issue.

No response

Metadata

Metadata

Assignees

Labels

area:languages/goGo programming language supportstate:reproducibleVerified steps to reproduce included and someone on the team managed to reproduce

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions