From 5177e3c79e2756a2462d6c3cc6eb50662a5d0517 Mon Sep 17 00:00:00 2001 From: haitham911 Date: Mon, 10 Feb 2025 23:23:51 +0200 Subject: [PATCH] add more log to verifyOutput --- tests/cli_test.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/cli_test.go b/tests/cli_test.go index 28ddc8402..255b436b0 100644 --- a/tests/cli_test.go +++ b/tests/cli_test.go @@ -586,7 +586,7 @@ func verifyExitCode(t *testing.T, expected, actual int) bool { func verifyOutput(t *testing.T, outputType, output string, patterns []MatchPattern) bool { success := true - output, err := sanitizeOutput(output) + sanitizeOutput, err := sanitizeOutput(output) if err != nil { t.Fatalf("failed to sanitize stdout output: %v", err) } @@ -598,14 +598,16 @@ func verifyOutput(t *testing.T, outputType, output string, patterns []MatchPatte continue } - match := re.MatchString(output) + match := re.MatchString(sanitizeOutput) if pattern.Negate && match { t.Errorf("Reason: %s unexpectedly matched negated pattern %q.", outputType, pattern.Pattern) - t.Errorf("Output: %q", output) + t.Errorf("sanitize Output: %q", sanitizeOutput) + t.Errorf("stdout Output: %q", output) success = false } else if !pattern.Negate && !match { t.Errorf("Reason: %s did not match pattern %q.", outputType, pattern.Pattern) - t.Errorf("Output: %q", output) + t.Errorf("sanitize Output: %q", sanitizeOutput) + t.Errorf("stdout Output: %q", output) success = false } }