Module: wine Branch: master Commit: 5c47f4a269b48ddfa1f450a9fa6c13182e366dca URL: http://source.winehq.org/git/wine.git/?a=commit;h=5c47f4a269b48ddfa1f450a9fa...
Author: Jacek Caban jacek@codeweavers.com Date: Tue Jan 17 12:42:08 2012 +0100
jscript: Added labelled statements tests.
---
dlls/jscript/tests/api.js | 7 +++++ dlls/jscript/tests/lang.js | 55 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 0 deletions(-)
diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js index ed1acd2..be49179 100644 --- a/dlls/jscript/tests/api.js +++ b/dlls/jscript/tests/api.js @@ -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"); diff --git a/dlls/jscript/tests/lang.js b/dlls/jscript/tests/lang.js index a035ebe..b6fe821 100644 --- a/dlls/jscript/tests/lang.js +++ b/dlls/jscript/tests/lang.js @@ -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();