Skip to content

Commit 97a0763

Browse files
committed
Merge branch 'master' of github.com:ochafik/nativelibs4java
2 parents 2524fa7 + eb1ad32 commit 97a0763

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

libraries/BridJ/src/test/java/org/bridj/DemanglingTest.java

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ public void testLongLongBackReference() {
120120
"_Z14test_add9_longlllllllll",
121121
null,
122122
ident("test_add9_long"),
123-
// long.class, long.class, long.class, long.class, long.class, long.class, long.class, long.class, long.class, long.class
123+
//long.class, long.class, long.class, long.class, long.class, long.class, long.class, long.class, long.class, long.class
124+
//long.class, clongType, clongType, clongType, clongType, clongType, clongType, clongType, clongType, clongType
124125
clongType, clongType, clongType, clongType, clongType, clongType, clongType, clongType, clongType, clongType
125126
);
126127
}
@@ -468,9 +469,9 @@ static IdentLike ident(String name) {
468469
static void demangle(String vc9, String gcc4, Type enclosingType, IdentLike memberName, Type returnType, Object... paramTypes) {
469470
try {
470471
if (vc9 != null)
471-
checkSymbol(vc9, new VC9Demangler(null, vc9).parseSymbol(), enclosingType, memberName, returnType, paramTypes, null, null);
472+
checkSymbol("msvc", vc9, new VC9Demangler(null, vc9).parseSymbol(), enclosingType, memberName, returnType, paramTypes, null, null);
472473
if (gcc4 != null)
473-
checkSymbol(gcc4, new GCC4Demangler(null, gcc4).parseSymbol(), enclosingType, memberName, returnType, paramTypes,null, null);
474+
checkSymbol("gcc", gcc4, new GCC4Demangler(null, gcc4).parseSymbol(), enclosingType, memberName, returnType, paramTypes,null, null);
474475
} catch (DemanglingException ex) {
475476
Logger.getLogger(DemanglingTest.class.getName()).log(Level.SEVERE, null, ex);
476477
throw new AssertionError(ex.toString());
@@ -489,26 +490,27 @@ static void demangle(String vc9, String gcc4, String toString) {
489490
}
490491
}
491492

492-
static void checkSymbol(String str, MemberRef symbol, Type enclosingType, IdentLike memberName, Type returnType, Object[] paramTypes, Annotation[][] paramAnns, AnnotatedElement element) {
493+
static void checkSymbol(String demanglerName, String str, MemberRef symbol, Type enclosingType, IdentLike memberName, Type returnType, Object[] paramTypes, Annotation[][] paramAnns, AnnotatedElement element) {
494+
String demanglerSuffix = " for " + demanglerName;
493495
if (symbol == null)
494-
assertTrue("Symbol not successfully parsed \"" + str + "\"", false);
496+
assertTrue("Symbol not successfully parsed" + demanglerSuffix + ": \"" + str + "\"", false);
495497
if (memberName != null)
496-
assertEquals("Bad name", memberName, symbol.getMemberName());
498+
assertEquals("Bad name" + demanglerSuffix, memberName, symbol.getMemberName());
497499
if (enclosingType != null) {
498-
assertNotNull("Null enclosing type : " + symbol, symbol.getEnclosingType());
499-
assertTrue("Bad enclosing type (got " + symbol.getEnclosingType() + ", expected " + (enclosingType instanceof Class ? ((Class)enclosingType).getName() : enclosingType.toString()) + ")", symbol.getEnclosingType().matches(enclosingType, Demangler.annotations(enclosingType)));
500+
assertNotNull("Null enclosing type" + demanglerSuffix + " : " + symbol, symbol.getEnclosingType());
501+
assertTrue("Bad enclosing type"+ demanglerSuffix + " (got " + symbol.getEnclosingType() + ", expected " + (enclosingType instanceof Class ? ((Class)enclosingType).getName() : enclosingType.toString()) + ")", symbol.getEnclosingType().matches(enclosingType, Demangler.annotations(enclosingType)));
500502
}
501503
if (returnType != null && symbol.getValueType() != null)
502-
assertTrue("Bad return type : expected " + returnType + ", got " + symbol.getValueType() + " (got class " + symbol.getValueType().getClass().getName() + ")", symbol.getValueType().matches(returnType, Demangler.annotations(element)));
504+
assertTrue("Bad return type"+ demanglerSuffix + " : expected " + returnType + ", got " + symbol.getValueType() + " (got class " + symbol.getValueType().getClass().getName() + ")", symbol.getValueType().matches(returnType, Demangler.annotations(element)));
503505

504506
int nArgs = symbol.paramTypes.length;
505-
assertEquals("Bad number of parameters (symbol = " + symbol + ")", paramTypes.length, nArgs);
507+
assertEquals("Bad number of parameters"+ demanglerSuffix + " (symbol = " + symbol + ")", paramTypes.length, nArgs);
506508

507509
for (int iArg = 0; iArg < nArgs; iArg++) {
508510
if (paramTypes[iArg] instanceof Type) {
509511
Type expecting = (Type)paramTypes[iArg];
510512
TypeRef demangled = symbol.paramTypes[iArg];
511-
assertTrue("Bad type for " + (iArg + 1) + "th param : (symbol = " + symbol + ", expecting " + expecting + " and demangled " + demangled + " (" + demangled.getClass().getName() + ")",
513+
assertTrue("Bad type for " + (iArg + 1) + "th param"+ demanglerSuffix + " : (symbol = " + symbol + ", expecting " + expecting + " and demangled " + demangled + " (" + demangled.getClass().getName() + ")",
512514
demangled.matches(expecting, paramAnns == null ? null : Demangler.annotations(paramAnns[iArg])));
513515

514516
} else if (paramTypes[iArg] instanceof String) {
Binary file not shown.

0 commit comments

Comments
 (0)