Some cleanup
This commit is contained in:
@@ -130,32 +130,28 @@ class StringCase extends TestCase {
|
||||
assertEq("'hello ${5} world'", 'hello ${5} world');
|
||||
assertEq("'hello ${5}'", 'hello ${5}');
|
||||
|
||||
//Util.runKnownBug("string.code doesnt work", () -> {
|
||||
assertEq('"f".code', "f".code);
|
||||
assertEq('"o".code', "o".code);
|
||||
assertEq('"1".code', "1".code);
|
||||
assertEq('"b".code', "b".code);
|
||||
assertEq('"a".code', "a".code);
|
||||
assertEq('"r".code', "r".code);
|
||||
assertEq('"r".code', "r".code);
|
||||
assertError('"foo".code', Parser.getBaseError(EPreset(INVALID_CHAR_CODE_MULTI))); // multiple chars causes error
|
||||
assertError('"bar".code', Parser.getBaseError(EPreset(INVALID_CHAR_CODE_MULTI))); // multiple chars causes error
|
||||
//});
|
||||
assertEq('"f".code', "f".code);
|
||||
assertEq('"o".code', "o".code);
|
||||
assertEq('"1".code', "1".code);
|
||||
assertEq('"b".code', "b".code);
|
||||
assertEq('"a".code', "a".code);
|
||||
assertEq('"r".code', "r".code);
|
||||
assertEq('"r".code', "r".code);
|
||||
assertError('"foo".code', Parser.getBaseError(EPreset(INVALID_CHAR_CODE_MULTI))); // multiple chars causes error
|
||||
assertError('"bar".code', Parser.getBaseError(EPreset(INVALID_CHAR_CODE_MULTI))); // multiple chars causes error
|
||||
|
||||
headerCode = '';
|
||||
var a = 103;
|
||||
|
||||
//Util.runKnownBug("String.fromCharCode doesnt work", () -> {
|
||||
assertEq('String.fromCharCode(65)', String.fromCharCode(65));
|
||||
assertEq('String.fromCharCode(97)', String.fromCharCode(97));
|
||||
assertEq('String.fromCharCode(98)', String.fromCharCode(98));
|
||||
assertEq('String.fromCharCode(99)', String.fromCharCode(99));
|
||||
assertEq('String.fromCharCode(100)', String.fromCharCode(100));
|
||||
assertEq('String.fromCharCode(101)', String.fromCharCode(101));
|
||||
assertEq('String.fromCharCode(102)', String.fromCharCode(102));
|
||||
assertEq('String.fromCharCode(103)', String.fromCharCode(103));
|
||||
assertEq('var a = 103; String.fromCharCode(a)', String.fromCharCode(test));
|
||||
//});
|
||||
assertEq('String.fromCharCode(65)', String.fromCharCode(65));
|
||||
assertEq('String.fromCharCode(97)', String.fromCharCode(97));
|
||||
assertEq('String.fromCharCode(98)', String.fromCharCode(98));
|
||||
assertEq('String.fromCharCode(99)', String.fromCharCode(99));
|
||||
assertEq('String.fromCharCode(100)', String.fromCharCode(100));
|
||||
assertEq('String.fromCharCode(101)', String.fromCharCode(101));
|
||||
assertEq('String.fromCharCode(102)', String.fromCharCode(102));
|
||||
assertEq('String.fromCharCode(103)', String.fromCharCode(103));
|
||||
assertEq('var a = 103; String.fromCharCode(a)', String.fromCharCode(test));
|
||||
|
||||
assertError("'hello ${}'", Parser.getBaseError(EPreset(EMPTY_INTERPOLATION)));
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ class TestCase extends HScriptRunner {
|
||||
}
|
||||
|
||||
public function assertError(script:String, expectedError:hscript.Error, ?message:String, ?vars:Dynamic, ?pos:haxe.PosInfos) {
|
||||
var expectedError = Printer.getPrintableError(expectedError);
|
||||
if(message == null)
|
||||
message = script;
|
||||
try {
|
||||
@@ -29,17 +30,18 @@ class TestCase extends HScriptRunner {
|
||||
else
|
||||
executeUnsafe(script);
|
||||
Sys.println("# For script: " + script);
|
||||
Sys.println("## Expected error: " + Tools.cleanError(expectedError));
|
||||
Sys.println("## Expected error: " + expectedError);
|
||||
Sys.println("## Got result: " + result);
|
||||
Sys.println("> " + Printer.convertExprToString(lastExpr));
|
||||
return Util.failed();
|
||||
} catch(e:hscript.Error) {
|
||||
if(Printer.compareErrors(e, expectedError)) {
|
||||
var e = Printer.getPrintableError(e);
|
||||
if(Type.enumEq(e, expectedError)) {
|
||||
return Util.passed();
|
||||
} else {
|
||||
Sys.println("# For script: " + script);
|
||||
Sys.println("## Expected error: " + Tools.cleanError(expectedError));
|
||||
Sys.println("## Actual error: " + Tools.cleanError(e));
|
||||
Sys.println("## Expected error: " + expectedError);
|
||||
Sys.println("## Actual error: " + e);
|
||||
return Util.failed();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user