From 0da1c9a9d732ccf1b79c4a127b24bdb8901c3821 Mon Sep 17 00:00:00 2001 From: Alessandro Arzilli Date: Tue, 4 May 2021 21:37:09 +0200 Subject: [PATCH] Documentation: document passing arguments to the test program (#2459) Add documentation on how to pass arguments to the program generated by `dlv test`. Fixes #2458 --- Documentation/usage/dlv_test.md | 6 +++++- cmd/dlv/cmds/commands.go | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Documentation/usage/dlv_test.md b/Documentation/usage/dlv_test.md index e86207cd..59198414 100644 --- a/Documentation/usage/dlv_test.md +++ b/Documentation/usage/dlv_test.md @@ -10,7 +10,11 @@ Compiles a test binary with optimizations disabled and begins a new debug sessio The test command allows you to begin a new debug session in the context of your unit tests. By default Delve will debug the tests in the current directory. Alternatively you can specify a package name, and Delve will debug the tests in -that package instead. +that package instead. Double-dashes `--` can be used to pass arguments to the test program: + +dlv test [package] -- -test.v -other-argument + +See also: 'go help testflag'. ``` dlv test [package] diff --git a/cmd/dlv/cmds/commands.go b/cmd/dlv/cmds/commands.go index 2e94261f..3d097b26 100644 --- a/cmd/dlv/cmds/commands.go +++ b/cmd/dlv/cmds/commands.go @@ -253,7 +253,11 @@ or later, -gcflags="-N -l" on earlier versions of Go.`, The test command allows you to begin a new debug session in the context of your unit tests. By default Delve will debug the tests in the current directory. Alternatively you can specify a package name, and Delve will debug the tests in -that package instead.`, +that package instead. Double-dashes ` + "`--`" + ` can be used to pass arguments to the test program: + +dlv test [package] -- -test.v -other-argument + +See also: 'go help testflag'.`, Run: testCmd, } testCommand.Flags().String("output", "debug.test", "Output path for the binary.")