@@ -30178,46 +30178,58 @@ var casesExpectedFailures = map[string]bool{
3017830178 "_ZZZZN6abcdef9abcdefghi29abcdefabcdefabcdefabcefabcdef27xxxxxxxxxxxxxxxxxxxxxxxxxxxEN4absl8DurationERKNSt3__u12basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEPNS1_19yyyyyyyyyyyyyyyyyyyEENK3$_5clEvENKUlvE_clEvE6zzzzzz": true,
3017930179 "_Z1fIXtl1BadsoiL_Z6nestedE_EEEEvv": true,
3018030180 "_Z1fIXtl1BcvPiplcvPcadL_Z7derivedELl16EEEEvv": true,
30181- "_Z1fIXtl1DmcM7DerivedKiadL_ZN11MoreDerived1zEEn8EEEEvv": true,
3018230181 "_Z1fIXtl1Edi1nLi42EEEEvv": true,
3018330182 "_Z1h1XIJZ1fIiEDaOT_E1AZ1gIdEDaS2_E1BEE": true,
3018430183 "_ZN1A1gIiEEDTcldtptfpT1b1fIT_EEEv": true,
3018530184}
3018630185
3018730186// caseExceptions is a list of exceptions from the LLVM list that we
3018830187// do not handle the same as the LLVM demangler. We keep a list of
30189- // exceptions so that we can use an exact copy of the test cases.
30190- var casesExceptions = map[string]bool{
30188+ // exceptions so that we can use an exact copy of the test cases. We
30189+ // map to an empty string if we expect a demangling failure; this
30190+ // differs from caseExpectedFailures in that we've decided that we
30191+ // intentionally should not demangle this case. Otherwise this maps
30192+ // to the expected demangling.
30193+ var casesExceptions = map[string]string{
30194+ "_Z1fIXtl1DmcM7DerivedKiadL_ZN11MoreDerived1zEEn8EEEEvv" : "void f<D{(int const Derived::*)(&MoreDerived::z)}>()",
3019130195}
3019230196
3019330197func TestCases(t *testing.T) {
30198+ t.Parallel()
3019430199 expectedFails := 0
3019530200 found := make(map[string]bool)
3019630201 for _, test := range cases {
3019730202 expectedFail := casesExpectedFailures[test[0]]
30198- exception := casesExceptions[test[0]]
30203+ exception, haveException := casesExceptions[test[0]]
30204+ if expectedFail && haveException {
30205+ t.Errorf("test case error: %s in both expectedFailures and exceptions", test[0])
30206+ }
30207+ want := test[1]
30208+ if haveException && exception != "" {
30209+ want = exception
30210+ }
3019930211 if got, err := ToString(test[0]); err != nil {
30200- if expectedFail {
30212+ if expectedFail || (haveException && exception == "") {
3020130213 t.Logf("demangling %s: expected failure: error %v", test[0], err)
30202- expectedFails++
30203- found[test[0]] = true
30204- } else if exception {
30205- t.Logf("demangling %s: ignore expected difference: error %v", test[0], err)
30214+ if expectedFail {
30215+ expectedFails++
30216+ found[test[0]] = true
30217+ }
3020630218 } else {
3020730219 t.Errorf("demangling %s: unexpected error %v", test[0], err)
3020830220 }
30209- } else if got != test[1] {
30221+ } else if got != want {
3021030222 if expectedFail {
30211- t.Logf("demangling %s: expected failure: got %s, want %s", test[0], got, test[1] )
30223+ t.Logf("demangling %s: expected failure: got %s, want %s", test[0], got, want )
3021230224 expectedFails++
3021330225 found[test[0]] = true
30214- } else if exception {
30215- t.Logf ("demangling %s: ignore expected difference: got %s, want %s", test[0], got, test[1] )
30226+ } else if haveException && exception == "" {
30227+ t.Errorf ("demangling %s: expected to fail, but succeeded with %s", test[0], got)
3021630228 } else {
30217- t.Errorf("demangling %s: got %s, want %s", test[0], got, test[1] )
30229+ t.Errorf("demangling %s: got %s, want %s", test[0], got, want )
3021830230 }
30219- } else if expectedFail || exception {
30220- t.Errorf("demangling %s: expected to fail, but succeeded", test[0])
30231+ } else if expectedFail || (haveException && exception == "") {
30232+ t.Errorf("demangling %s: expected to fail, but succeeded with %s ", test[0], got )
3022130233 if expectedFail {
3022230234 found[test[0]] = true
3022330235 }
0 commit comments