Jacek Caban : jscript: Added tests for @if/@elif/@else/@end.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Oct 1 14:34:31 CDT 2014


Module: wine
Branch: master
Commit: 68c61d17e0c5af5251d440efb0ee7c5292b598f5
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=68c61d17e0c5af5251d440efb0ee7c5292b598f5

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Oct  1 10:45:21 2014 +0200

jscript: Added tests for @if/@elif/@else/@end.

---

 dlls/jscript/tests/cc.js | 104 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 104 insertions(+)

diff --git a/dlls/jscript/tests/cc.js b/dlls/jscript/tests/cc.js
index b96f21e..32f827e 100644
--- a/dlls/jscript/tests/cc.js
+++ b/dlls/jscript/tests/cc.js
@@ -140,9 +140,107 @@ ok(@test === false, "@test = " + @test);
 @set @test = (0 != true)
 ok(@test === true, "@test = " + @test);
 
+ at if (false)
+    this wouldn not parse
+"@end
+
+ at if (false) "@end
+
+tmp = "@if (false) @end";
+ok(tmp.length === 16, "tmp.length = " + tmp.length);
+
+ at if(true)
+tmp = true
+ at end
+ok(tmp === true, "tmp = " + tmp);
+
+ at if(false)
+ at if this would not CC parse
+this will not parse
+ at elif(true)
+this will also not parse
+ at else
+this also will not parse
+ at if let me complicate things a bit
+ at end enough
+ at end
+ at end
+
+ at if(false)
+this will not parse
+ at else
+tmp = 2
+ at else
+this will not be parsed
+ at else
+also this
+ at end
+ok(tmp === 2, "tmp = " + tmp);
+
+ at if(true)
+tmp = 3;
+ at else
+just skip this
+ at end
+ok(tmp === 3, "tmp = " + tmp);
+
+ at if(true)
+tmp = 4;
+ at elif(true)
+this will not parse
+ at elif nor this
+ at else
+just skip this
+ at end
+ok(tmp === 4, "tmp = " + tmp);
+
+ at if(false)
+this will not parse
+ at elif(false)
+nor this would
+ at elif(true)
+tmp = 5;
+ at elif nor this
+ at else
+just skip this
+ at end
+ok(tmp === 5, "tmp = " + tmp);
+
+ at if (!@_jscript)
+this would not parse
+ at if(true)
+ at else
+ at if(false)
+ at end
+ at end
+ at elif (@_jscript)
+tmp = 6;
+ at elif (true)
+ at if xxx
+ at else
+ at if @elif @elif @else @end
+ at end
+ at else
+this would not parse
+ at end
+ok(tmp === 6, "tmp = " + tmp);
+
+ at if(true)
+ at if(false)
+ at else
+tmp = 7;
+ at end
+ at else
+this would not parse
+ at end
+ok(tmp === 7, "tmp = " + tmp);
+
 var exception_map = {
+    JS_E_SYNTAX:               {type: "SyntaxError", number: -2146827286},
+    JS_E_MISSING_LBRACKET:     {type: "SyntaxError", number: -2146827283},
     JS_E_EXPECTED_IDENTIFIER:  {type: "SyntaxError", number: -2146827278},
     JS_E_EXPECTED_ASSIGN:      {type: "SyntaxError", number: -2146827277},
+    JS_E_EXPECTED_CCEND:       {type: "SyntaxError", number: -2146827259},
     JS_E_EXPECTED_AT:          {type: "SyntaxError", number: -2146827256}
 };
 
@@ -164,5 +262,11 @@ function testException(src, id) {
 testException("@set test=true", "JS_E_EXPECTED_AT");
 testException("@set @1=true", "JS_E_EXPECTED_IDENTIFIER");
 testException("@set @test x=true", "JS_E_EXPECTED_ASSIGN");
+testException("@if false\n at end", "JS_E_MISSING_LBRACKET");
+testException("@if (false)\n", "JS_E_EXPECTED_CCEND");
+testException("@end\n", "JS_E_SYNTAX");
+testException("@elif\n", "JS_E_SYNTAX");
+testException("@else\n", "JS_E_SYNTAX");
+testException("@if false\n at elif true\n at end", "JS_E_MISSING_LBRACKET");
 
 reportSuccess();




More information about the wine-cvs mailing list