Skip to content

Commit

Permalink
demangle: in TestCases count failures and differences separately
Browse files Browse the repository at this point in the history
  • Loading branch information
ianlancetaylor committed Mar 12, 2021
1 parent 94bb783 commit 7a0008c
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions cases_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30086,7 +30086,8 @@ var casesExceptions = map[string]string{

func TestCases(t *testing.T) {
t.Parallel()
expectedFails := 0
expectedErrors := 0
expectedDifferent := 0
found := make(map[string]bool)
for _, test := range cases {
expectedFail := casesExpectedFailures[test[0]]
Expand All @@ -30102,7 +30103,7 @@ func TestCases(t *testing.T) {
if expectedFail || (haveException && exception == "") {
t.Logf("demangling %s: expected failure: error %v", test[0], err)
if expectedFail {
expectedFails++
expectedErrors++
found[test[0]] = true
}
} else {
Expand All @@ -30111,7 +30112,7 @@ func TestCases(t *testing.T) {
} else if got != want && !closeEnoughCase(got, want) {
if expectedFail {
t.Logf("demangling %s: expected failure: got %s, want %s", test[0], got, want)
expectedFails++
expectedDifferent++
found[test[0]] = true
} else if haveException && exception == "" {
t.Errorf("demangling %s: expected to fail, but succeeded with %s", test[0], got)
Expand All @@ -30137,8 +30138,11 @@ func TestCases(t *testing.T) {
}
}
}
if expectedFails > 0 {
t.Logf("%d expected failures out of %d cases", expectedFails, len(cases))
if expectedDifferent > 0 {
t.Logf("%d different demanglings out of %d cases", expectedDifferent, len(cases))
}
if expectedErrors > 0 {
t.Logf("%d expected failures out of %d cases", expectedErrors, len(cases))
}
}

Expand Down

0 comments on commit 7a0008c

Please sign in to comment.