Fixes some bugs

This commit is contained in:
Alexey Andreev 2013-11-28 17:42:06 +04:00
parent e32da9316f
commit f6927a72af
4 changed files with 9 additions and 19 deletions

View File

@ -20,6 +20,6 @@ public class AssertNativeGenerator implements Generator {
}
private void generateFail(SourceWriter writer) {
writer.append("throw new JUnitAssertionFailure();").newLine();
writer.append("throw new Error();").newLine();
}
}

View File

@ -1,6 +1,3 @@
JUnitAssertionFailure = function() {}
JUnitAssertionFailure.prototype = new Error();
currentTestReportBody = null;
runTestCase = function(instance, methodName, realMethodName) {
@ -17,17 +14,10 @@ runTestCase = function(instance, methodName, realMethodName) {
instance[realMethodName]();
statusCell.appendChild(document.createTextNode("ok"));
} catch (e) {
if (e instanceof JUnitAssertionFailure) {
statusCell.appendChild(document.createTextNode("assertion failed"));
var exceptionText = document.createElement("pre");
exceptionText.appendChild(document.createTextNode(e.stack));
exceptionCell.appendChild(exceptionText);
} else {
statusCell.appendChild(document.createTextNode("unexpected exception"));
var exceptionText = document.createElement("pre");
exceptionText.appendChild(document.createTextNode(e.stack));
exceptionCell.appendChild(exceptionText);
}
statusCell.appendChild(document.createTextNode("unexpected exception"));
var exceptionText = document.createElement("pre");
exceptionText.appendChild(document.createTextNode(e.stack));
exceptionCell.appendChild(exceptionText);
}
}

View File

@ -59,7 +59,7 @@ public class DefaultNamingStrategy implements NamingStrategy {
if (methodHolder.getModifiers().contains(ElementModifier.STATIC) ||
method.getDescriptor().getName().equals("<init>") ||
methodHolder.getLevel() == AccessLevel.PRIVATE) {
String key = method.getClassName() + "#" + method.toString();
String key = method.toString();
String alias = privateAliases.get(key);
if (alias == null) {
alias = aliasProvider.getAlias(method);
@ -67,7 +67,7 @@ public class DefaultNamingStrategy implements NamingStrategy {
}
return alias;
} else {
String key = method.toString();
String key = method.getDescriptor().toString();
String alias = aliases.get(key);
if (alias == null) {
alias = aliasProvider.getAlias(method);

View File

@ -75,8 +75,8 @@ public class Renderer implements ExprVisitor, StatementVisitor {
writer.append("for (var i = 0; i < str.length; i = (i + 1) | 0) {").indent().newLine();
writer.append("characters[i] = str.charCodeAt(i);").newLine();
writer.outdent().append("}").newLine();
writer.append("return $rt_init(").appendClass("java.lang.String").append(", '")
.appendMethod(stringCons).append("', characters);").newLine();
writer.append("return ").appendClass("java.lang.String").append(".")
.appendMethod(stringCons).append("(characters);").newLine();
writer.outdent().append("}").newLine();
}