[gjs/wip/strict: 2/2] Enable strict mode by default
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/wip/strict: 2/2] Enable strict mode by default
- Date: Tue, 1 Oct 2013 00:11:56 +0000 (UTC)
commit 78d5019ed7b66f27c0f266432b8c191df60d2de6
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Wed Jul 17 12:43:18 2013 -0400
Enable strict mode by default
gjs/context.c | 2 +-
installed-tests/js/testMainloop.js | 8 +--
installed-tests/js/testTweener.js | 92 +++++++++++-------------------------
3 files changed, 32 insertions(+), 70 deletions(-)
---
diff --git a/gjs/context.c b/gjs/context.c
index b9d4a07..e2d87ad 100644
--- a/gjs/context.c
+++ b/gjs/context.c
@@ -587,7 +587,7 @@ gjs_context_constructor (GType type,
*
* JSOPTION_STRICT: Report warnings to error reporter function.
*/
- options_flags = JSOPTION_DONT_REPORT_UNCAUGHT | JSOPTION_STRICT;
+ options_flags = JSOPTION_DONT_REPORT_UNCAUGHT | JSOPTION_STRICT | JSOPTION_STRICT_MODE;
if (!g_getenv("GJS_DISABLE_JIT")) {
gjs_debug(GJS_DEBUG_CONTEXT, "Enabling JIT");
diff --git a/installed-tests/js/testMainloop.js b/installed-tests/js/testMainloop.js
index 792e006..930989c 100644
--- a/installed-tests/js/testMainloop.js
+++ b/installed-tests/js/testMainloop.js
@@ -34,11 +34,9 @@ function testTimeout() {
Mainloop.run('testtimeout');
- with (trackTimeout) {
- JSUnit.assertEquals("run ten times", 10, runTenTimes);
- JSUnit.assertEquals("run only once", 1, runOnlyOnce);
- JSUnit.assertEquals("never run", 0, neverRun);
- }
+ JSUnit.assertEquals("run ten times", 10, trackTimeout.runTenTimes);
+ JSUnit.assertEquals("run only once", 1, trackTimeout.runOnlyOnce);
+ JSUnit.assertEquals("never run", 0, trackTimeout.neverRun);
}
function testIdle() {
diff --git a/installed-tests/js/testTweener.js b/installed-tests/js/testTweener.js
index 72c3f93..3665f13 100644
--- a/installed-tests/js/testTweener.js
+++ b/installed-tests/js/testTweener.js
@@ -60,15 +60,11 @@ function testSimpleTween() {
Mainloop.run('testTweener');
- with (objectA) {
- JSUnit.assertEquals("A: x coordinate", 10, x);
- JSUnit.assertEquals("A: y coordinate", 10, y);
- }
-
- with (objectB) {
- JSUnit.assertEquals("B: x coordinate", 5, x);
- JSUnit.assertEquals("B: y coordinate", 5, y);
- }
+ JSUnit.assertEquals("A: x coordinate", 10, objectA.x);
+ JSUnit.assertEquals("A: y coordinate", 10, objectA.y);
+
+ JSUnit.assertEquals("B: x coordinate", 5, objectB.x);
+ JSUnit.assertEquals("B: y coordinate", 5, objectB.y);
}
function testOnFunctions() {
@@ -92,11 +88,9 @@ function testOnFunctions() {
Mainloop.run('testOnFunctions');
- with (object) {
- JSUnit.assertEquals("onStart was run", true, start);
- JSUnit.assertEquals("onUpdate was run", true, update);
- JSUnit.assertEquals("onComplete was run", true, complete);
- }
+ JSUnit.assertEquals("onStart was run", true, object.start);
+ JSUnit.assertEquals("onUpdate was run", true, object.update);
+ JSUnit.assertEquals("onComplete was run", true, object.complete);
}
function testPause() {
@@ -125,17 +119,9 @@ function testPause() {
Mainloop.run('testPause');
- with (objectA) {
- JSUnit.assertEquals(0, foo);
- }
-
- with (objectB) {
- JSUnit.assertEquals(100, bar);
- }
-
- with (objectC) {
- JSUnit.assertEquals(100, baaz);
- }
+ JSUnit.assertEquals(0, objectA.foo);
+ JSUnit.assertEquals(100, objectB.bar);
+ JSUnit.assertEquals(100, objectC.baaz);
}
function testRemoveTweens() {
@@ -154,11 +140,9 @@ function testRemoveTweens() {
Tweener.removeTweens(object, "bar", "baaz");
Mainloop.run('testRemoveTweens');
- with (object) {
- JSUnit.assertEquals(50, foo);
- JSUnit.assertEquals(0, bar);
- JSUnit.assertEquals(0, baaz);
- }
+ JSUnit.assertEquals(50, object.foo);
+ JSUnit.assertEquals(0, object.bar);
+ JSUnit.assertEquals(0, object.baaz);
}
function testConcurrent() {
@@ -187,13 +171,8 @@ function testConcurrent() {
Mainloop.run('testConcurrent');
- with (objectA) {
- JSUnit.assertEquals(0, foo);
- }
-
- with (objectB) {
- JSUnit.assertEquals(150, bar);
- }
+ JSUnit.assertEquals(0, objectA.foo);
+ JSUnit.assertEquals(150, objectB.bar);
}
function testPauseAllResumeAll() {
@@ -217,13 +196,8 @@ function testPauseAllResumeAll() {
Mainloop.run('testPauseAllResumeAll');
- with (objectA) {
- JSUnit.assertEquals(100, foo);
- }
-
- with (objectB) {
- JSUnit.assertEquals(100, bar);
- }
+ JSUnit.assertEquals(100, objectA.foo);
+ JSUnit.assertEquals(100, objectB.bar);
}
function testRemoveAll() {
@@ -267,9 +241,7 @@ function testImmediateTween() {
Mainloop.run('testImmediateTween');
- with (object) {
- JSUnit.assertEquals(200, foo);
- }
+ JSUnit.assertEquals(200, object.foo);
}
function testAddCaller() {
@@ -288,9 +260,7 @@ function testAddCaller() {
Mainloop.run('testAddCaller');
- with (object) {
- JSUnit.assertEquals(10, foo);
- }
+ JSUnit.assertEquals(10, object.foo);
}
function testGetTweenCount() {
@@ -341,10 +311,8 @@ function testSpecialProperty() {
Mainloop.run('testSpecialProperty');
- with (objectA) {
- JSUnit.assertEquals("A: x coordinate", -10, x);
- JSUnit.assertEquals("A: y coordinate", 10, y);
- }
+ JSUnit.assertEquals("A: x coordinate", -10, objectA.x);
+ JSUnit.assertEquals("A: y coordinate", 10, objectA.y);
}
Tweener.registerSpecialPropertyModifier('discrete',
@@ -378,12 +346,10 @@ function testSpecialPropertyModifier() {
Mainloop.run('testSpecialPropertyModifier');
- with (objectA) {
- JSUnit.assertEquals("A: x coordinate", 10, x);
- JSUnit.assertEquals("A: y coordinate", 10, y);
- JSUnit.assertEquals("A: x was fractional", false, xFraction);
- JSUnit.assertEquals("A: y was fractional", true, yFraction);
- }
+ JSUnit.assertEquals("A: x coordinate", 10, objectA.x);
+ JSUnit.assertEquals("A: y coordinate", 10, objectA.y);
+ JSUnit.assertEquals("A: x was fractional", false, objectA.xFraction);
+ JSUnit.assertEquals("A: y was fractional", true, objectA.yFraction);
}
Tweener.registerSpecialPropertySplitter(
@@ -404,10 +370,8 @@ function testSpecialPropertySplitter() {
Mainloop.run('testSpecialPropertySplitter');
- with (objectA) {
- JSUnit.assertEquals("A: x coordinate", 10, x);
- JSUnit.assertEquals("A: y coordinate", -10, y);
- }
+ JSUnit.assertEquals("A: x coordinate", 10, objectA.x);
+ JSUnit.assertEquals("A: y coordinate", -10, objectA.y);
}
installFrameTicker();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]