[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: tests/khtmltests/regression/tests/js
From: Christopher E. Hyde <C.Hyde () parableuk ! force9 ! co ! uk>
Date: 2007-05-26 17:52:33
Message-ID: 1180201953.318171.6155.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 668538 by chyde:
demonstrates local const variables regression
M +50 -0 const.js
--- trunk/tests/khtmltests/regression/tests/js/const.js #668537:668538
@@ -13,4 +13,54 @@
break;
}
+// local vars & consts
+function h ()
+{
+ function shouldBe(_a, _b)
+ {
+ if (typeof _a != "string" || typeof _b != "string")
+ debug("WARN: shouldBe() expects string arguments");
+ var _av, _bv;
+ try {
+ _av = eval(_a);
+ } catch (e) {
+ _av = evalError(_a, e);
+ }
+ try {
+ _bv = eval(_b);
+ } catch (e) {
+ _bv = evalError(_b, e);
+ }
+
+ if (_av === _bv)
+ testPassed(_a + " is " + _b);
+ else
+ testFailed(_a + " should be " + _bv + ". Was " + _av);
+ }
+
+ var hvar = 1;
+ const hconst = 1;
+ shouldBe("hvar", "1");
+ shouldBe("hconst", "1");
+
+ hvar = 2;
+ hconst = 2;
+ shouldBe("hvar", "2");
+ shouldBe("hconst", "1");
+
+ ++hvar;
+ ++hconst;
+ shouldBe("hvar", "3");
+ shouldBe("hconst", "1");
+
+ shouldBe("(hvar = 4)", "4");
+ shouldBe("(hconst = 4)", "4");
+
+ shouldBe("hvar", "4");
+ shouldBe("hconst", "1");
+}
+
+h();
+h();
+
// ### check for forbidden redeclaration
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic