jscript: Added labelled statements tests.

This commit is contained in:
Jacek Caban 2012-01-17 12:42:08 +01:00 committed by Alexandre Julliard
parent 4aec6b1090
commit 5c47f4a269
2 changed files with 62 additions and 0 deletions

View File

@ -1980,6 +1980,8 @@ var exception_array = {
E_DISABLED_CC: { type: "SyntaxError", number: -2146827258 },
E_INVALID_BREAK: { type: "SyntaxError", number: -2146827269 },
E_INVALID_CONTINUE: { type: "SyntaxError", number: -2146827268 },
E_LABEL_NOT_FOUND: { type: "SyntaxError", number: -2146827262 },
E_LABEL_REDEFINED: { type: "SyntaxError", number: -2146827263 },
E_ILLEGAL_ASSIGN: { type: "ReferenceError", number: -2146823280 },
@ -2088,6 +2090,11 @@ testSyntaxError("@a", "E_DISABLED_CC");
testSyntaxError("/* @cc_on @*/ @_jscript_version", "E_DISABLED_CC");
testSyntaxError("ok(false, 'unexpected execution'); break;", "E_INVALID_BREAK");
testSyntaxError("ok(false, 'unexpected execution'); continue;", "E_INVALID_CONTINUE");
testSyntaxError("ok(false, 'unexpected execution'); while(true) break unknown_label;", "E_LABEL_NOT_FOUND");
testSyntaxError("ok(false, 'unexpected execution'); some_label: continue some_label;", "E_INVALID_CONTINUE");
testSyntaxError("ok(false, 'unexpected execution'); while(true) continue some_label;", "E_LABEL_NOT_FOUND");
testSyntaxError("ok(false, 'unexpected execution'); some_label: { while(true) continue some_label; }", "E_INVALID_CONTINUE");
testSyntaxError("ok(false, 'unexpected execution'); some_label: { some_label: while(true); }", "E_LABEL_REDEFINED");
// ReferenceError tests
testException(function() {test = function() {}}, "E_ILLEGAL_ASSIGN");

View File

@ -920,6 +920,61 @@ for(var iter in [1,2,3]) {
}
ok(tmp, "tmp = " + tmp);
loop_label:
while(true) {
while(true)
break loop_label;
}
loop_label: {
tmp = 0;
while(true) {
while(true)
break loop_label;
}
ok(false, "unexpected evaluation 1");
}
while(true) {
some_label: break;
ok(false, "unexpected evaluation 2");
}
just_label: tmp = 1;
ok(tmp === 1, "tmp != 1");
some_label: break some_label;
other_label: {
break other_label;
ok(false, "unexpected evaluation 3");
}
loop_label:
do {
while(true)
continue loop_label;
}while(false);
loop_label:
for(i = 0; i < 3; i++) {
while(true)
continue loop_label;
}
loop_label:
other_label:
for(i = 0; i < 3; i++) {
while(true)
continue loop_label;
}
loop_label:
for(tmp in {prop: false}) {
while(true)
continue loop_label;
}
ok((void 1) === undefined, "(void 1) !== undefined");
var inobj = new Object();