From aaa116d1293a34650cfed12a4733e70ce2c24790 Mon Sep 17 00:00:00 2001 From: Dino Date: Fri, 14 Nov 2025 16:04:54 +0000 Subject: [PATCH] languages: Fix command used for Go subtests (#42734) The command used to run go subtests was breaking if the test contained square brackets, for example: ``` go test . -v -run ^TestInventoryCheckout$/^\[test\]_test_checkout$ ``` After a bit of testing it appears that the best way to actually resolve this in a way supported by `go test` is to wrap this command in quotes. As such, this commit updates the command to, considering the example above: ``` go test . -v -run '^TestInventoryCheckout$/^\[test\]_test_checkout$' ``` We also tested escape the square brackets, using `\\\[` instead of `\[`, but that would lead to a more complex change, so we opted for the simpler solution of wrapping the command in quotes. Closes #42347 Release Notes: - Fixed command used to run Go subtests to ensure that escaped characters don't lead to a failure in finding tests to run --- crates/languages/src/go.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/languages/src/go.rs b/crates/languages/src/go.rs index 6c75abf123af62b3f4ab43a6e94d3b040e2f010a..a8699fe9c2dc8cf99ca46a16fe75b1de6eea7ffa 100644 --- a/crates/languages/src/go.rs +++ b/crates/languages/src/go.rs @@ -654,7 +654,7 @@ impl ContextProvider for GoContextProvider { "-v".into(), "-run".into(), format!( - "\\^{}\\$/\\^{}\\$", + "'^{}$/^{}$'", VariableName::Symbol.template_value(), GO_SUBTEST_NAME_TASK_VARIABLE.template_value(), ),