acc: add -norepl flag that disables replacements (for debugging) (#2269)

This commit is contained in:
Denis Bilenko 2025-01-30 11:38:54 +01:00 committed by GitHub
parent a03ea73011
commit f1efbd7d9f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 2 deletions

View File

@ -25,7 +25,10 @@ import (
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
var KeepTmp bool var (
KeepTmp bool
NoRepl bool
)
// In order to debug CLI running under acceptance test, set this to full subtest name, e.g. "bundle/variables/empty" // In order to debug CLI running under acceptance test, set this to full subtest name, e.g. "bundle/variables/empty"
// Then install your breakpoints and click "debug test" near TestAccept in VSCODE. // Then install your breakpoints and click "debug test" near TestAccept in VSCODE.
@ -40,6 +43,7 @@ var InprocessMode bool
func init() { func init() {
flag.BoolVar(&InprocessMode, "inprocess", SingleTest != "", "Run CLI in the same process as test (for debugging)") flag.BoolVar(&InprocessMode, "inprocess", SingleTest != "", "Run CLI in the same process as test (for debugging)")
flag.BoolVar(&KeepTmp, "keeptmp", false, "Do not delete TMP directory after run") flag.BoolVar(&KeepTmp, "keeptmp", false, "Do not delete TMP directory after run")
flag.BoolVar(&NoRepl, "norepl", false, "Do not apply any replacements (for debugging)")
} }
const ( const (
@ -272,7 +276,9 @@ func doComparison(t *testing.T, repls testdiff.ReplacementsContext, dirRef, dirN
// Apply replacements to the new value only. // Apply replacements to the new value only.
// The reference value is stored after applying replacements. // The reference value is stored after applying replacements.
if !NoRepl {
valueNew = repls.Replace(valueNew) valueNew = repls.Replace(valueNew)
}
// The test did not produce an expected output file. // The test did not produce an expected output file.
if okRef && !okNew { if okRef && !okNew {