Skip to content

Commit

Permalink
add more log to verifyOutput
Browse files Browse the repository at this point in the history
  • Loading branch information
haitham911 committed Feb 10, 2025
1 parent 4ea3455 commit 5177e3c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tests/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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
}
}
Expand Down

0 comments on commit 5177e3c

Please sign in to comment.