mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2025-01-09 08:24:10 -08:00
Fixes some bugs
This commit is contained in:
parent
e32da9316f
commit
f6927a72af
|
@ -20,6 +20,6 @@ public class AssertNativeGenerator implements Generator {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generateFail(SourceWriter writer) {
|
private void generateFail(SourceWriter writer) {
|
||||||
writer.append("throw new JUnitAssertionFailure();").newLine();
|
writer.append("throw new Error();").newLine();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
JUnitAssertionFailure = function() {}
|
|
||||||
JUnitAssertionFailure.prototype = new Error();
|
|
||||||
|
|
||||||
currentTestReportBody = null;
|
currentTestReportBody = null;
|
||||||
|
|
||||||
runTestCase = function(instance, methodName, realMethodName) {
|
runTestCase = function(instance, methodName, realMethodName) {
|
||||||
|
@ -17,18 +14,11 @@ runTestCase = function(instance, methodName, realMethodName) {
|
||||||
instance[realMethodName]();
|
instance[realMethodName]();
|
||||||
statusCell.appendChild(document.createTextNode("ok"));
|
statusCell.appendChild(document.createTextNode("ok"));
|
||||||
} catch (e) {
|
} 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"));
|
statusCell.appendChild(document.createTextNode("unexpected exception"));
|
||||||
var exceptionText = document.createElement("pre");
|
var exceptionText = document.createElement("pre");
|
||||||
exceptionText.appendChild(document.createTextNode(e.stack));
|
exceptionText.appendChild(document.createTextNode(e.stack));
|
||||||
exceptionCell.appendChild(exceptionText);
|
exceptionCell.appendChild(exceptionText);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
testClass = function(className, classTests) {
|
testClass = function(className, classTests) {
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class DefaultNamingStrategy implements NamingStrategy {
|
||||||
if (methodHolder.getModifiers().contains(ElementModifier.STATIC) ||
|
if (methodHolder.getModifiers().contains(ElementModifier.STATIC) ||
|
||||||
method.getDescriptor().getName().equals("<init>") ||
|
method.getDescriptor().getName().equals("<init>") ||
|
||||||
methodHolder.getLevel() == AccessLevel.PRIVATE) {
|
methodHolder.getLevel() == AccessLevel.PRIVATE) {
|
||||||
String key = method.getClassName() + "#" + method.toString();
|
String key = method.toString();
|
||||||
String alias = privateAliases.get(key);
|
String alias = privateAliases.get(key);
|
||||||
if (alias == null) {
|
if (alias == null) {
|
||||||
alias = aliasProvider.getAlias(method);
|
alias = aliasProvider.getAlias(method);
|
||||||
|
@ -67,7 +67,7 @@ public class DefaultNamingStrategy implements NamingStrategy {
|
||||||
}
|
}
|
||||||
return alias;
|
return alias;
|
||||||
} else {
|
} else {
|
||||||
String key = method.toString();
|
String key = method.getDescriptor().toString();
|
||||||
String alias = aliases.get(key);
|
String alias = aliases.get(key);
|
||||||
if (alias == null) {
|
if (alias == null) {
|
||||||
alias = aliasProvider.getAlias(method);
|
alias = aliasProvider.getAlias(method);
|
||||||
|
|
|
@ -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("for (var i = 0; i < str.length; i = (i + 1) | 0) {").indent().newLine();
|
||||||
writer.append("characters[i] = str.charCodeAt(i);").newLine();
|
writer.append("characters[i] = str.charCodeAt(i);").newLine();
|
||||||
writer.outdent().append("}").newLine();
|
writer.outdent().append("}").newLine();
|
||||||
writer.append("return $rt_init(").appendClass("java.lang.String").append(", '")
|
writer.append("return ").appendClass("java.lang.String").append(".")
|
||||||
.appendMethod(stringCons).append("', characters);").newLine();
|
.appendMethod(stringCons).append("(characters);").newLine();
|
||||||
writer.outdent().append("}").newLine();
|
writer.outdent().append("}").newLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user