[gjs/wip/ptomato/tests: 11/12] tests: Move logError test to testExceptions.js
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/wip/ptomato/tests: 11/12] tests: Move logError test to testExceptions.js
- Date: Mon, 28 Nov 2016 05:32:49 +0000 (UTC)
commit 9388de3f598bdfceea43e053d9491efff5e96c18
Author: Philip Chimento <philip chimento gmail com>
Date: Sat Nov 26 15:47:32 2016 -0800
tests: Move logError test to testExceptions.js
This didn't really test stuff from the Regress library, so it should be
moved to the testExceptions file. As well, the test never asserted that
the expected messages were logged, so it would not have caught any test
failures.
installed-tests/js/testEverythingBasic.js | 64 ---------------------------
installed-tests/js/testExceptions.js | 68 +++++++++++++++++++++++++++++
2 files changed, 68 insertions(+), 64 deletions(-)
---
diff --git a/installed-tests/js/testEverythingBasic.js b/installed-tests/js/testEverythingBasic.js
index c75c166..e982172 100644
--- a/installed-tests/js/testEverythingBasic.js
+++ b/installed-tests/js/testEverythingBasic.js
@@ -619,70 +619,6 @@ function testGError() {
}
}
-function testGErrorMessages() {
- GLib.test_expect_message('Gjs', GLib.LogLevelFlags.LEVEL_WARNING,
- 'JS ERROR: Gio.IOErrorEnum: *');
- try {
- let file = Gio.file_new_for_path("\\/,.^!@&$_don't exist");
- file.read(null);
- } catch(e) {
- logError(e);
- }
-
- GLib.test_expect_message('Gjs', GLib.LogLevelFlags.LEVEL_WARNING,
- 'JS ERROR: Gio.IOErrorEnum: a message\ntestGErrorMessages@*');
- try {
- throw new Gio.IOErrorEnum({ message: 'a message', code: 0 });
- } catch(e) {
- logError(e);
- }
-
- GLib.test_expect_message('Gjs', GLib.LogLevelFlags.LEVEL_WARNING,
- 'JS ERROR: Gio.IOErrorEnum: a message\ntestGErrorMessages@*');
- logError(new Gio.IOErrorEnum({ message: 'a message', code: 0 }));
-
- // No stack for GLib.Error constructor
- GLib.test_expect_message('Gjs', GLib.LogLevelFlags.LEVEL_WARNING,
- 'JS ERROR: Gio.IOErrorEnum: a message');
- logError(new GLib.Error(Gio.IOErrorEnum, 0, 'a message'));
-
- GLib.test_expect_message('Gjs', GLib.LogLevelFlags.LEVEL_WARNING,
- 'JS ERROR: GLib.Error my-error: a message');
- logError(new GLib.Error(GLib.quark_from_string('my-error'), 0, 'a message'));
-
- // Now with prefix
-
- GLib.test_expect_message('Gjs', GLib.LogLevelFlags.LEVEL_WARNING,
- 'JS ERROR: prefix: Gio.IOErrorEnum: *');
- try {
- let file = Gio.file_new_for_path("\\/,.^!@&$_don't exist");
- file.read(null);
- } catch(e) {
- logError(e, 'prefix');
- }
-
- GLib.test_expect_message('Gjs', GLib.LogLevelFlags.LEVEL_WARNING,
- 'JS ERROR: prefix: Gio.IOErrorEnum: a message\ntestGErrorMessages@*');
- try {
- throw new Gio.IOErrorEnum({ message: 'a message', code: 0 });
- } catch(e) {
- logError(e, 'prefix');
- }
-
- GLib.test_expect_message('Gjs', GLib.LogLevelFlags.LEVEL_WARNING,
- 'JS ERROR: prefix: Gio.IOErrorEnum: a message\ntestGErrorMessages@*');
- logError(new Gio.IOErrorEnum({ message: 'a message', code: 0 }), 'prefix');
-
- // No stack for GLib.Error constructor
- GLib.test_expect_message('Gjs', GLib.LogLevelFlags.LEVEL_WARNING,
- 'JS ERROR: prefix: Gio.IOErrorEnum: a message');
- logError(new GLib.Error(Gio.IOErrorEnum, 0, 'a message'), 'prefix');
-
- GLib.test_expect_message('Gjs', GLib.LogLevelFlags.LEVEL_WARNING,
- 'JS ERROR: prefix: GLib.Error my-error: a message');
- logError(new GLib.Error(GLib.quark_from_string('my-error'), 0, 'a message'), 'prefix');
-}
-
function testWrongClassGObject() {
/* Function calls */
// Everything.func_obj_null_in expects a Everything.TestObj
diff --git a/installed-tests/js/testExceptions.js b/installed-tests/js/testExceptions.js
index 2a12fff..cf16ad8 100644
--- a/installed-tests/js/testExceptions.js
+++ b/installed-tests/js/testExceptions.js
@@ -1,4 +1,5 @@
const JSUnit = imports.jsUnit;
+const Gio = imports.gi.Gio;
const GLib = imports.gi.GLib;
const GObject = imports.gi.GObject;
const Lang = imports.lang;
@@ -114,4 +115,71 @@ function testExceptionInPropertyGetterWithBinding() {
'testExceptionInPropertyGetterWithBinding');
}
+function testGErrorMessages() {
+ GLib.test_expect_message('Gjs', GLib.LogLevelFlags.LEVEL_WARNING,
+ 'JS ERROR: Gio.IOErrorEnum: *');
+ try {
+ let file = Gio.file_new_for_path("\\/,.^!@&$_don't exist");
+ file.read(null);
+ } catch(e) {
+ logError(e);
+ }
+
+ GLib.test_expect_message('Gjs', GLib.LogLevelFlags.LEVEL_WARNING,
+ 'JS ERROR: Gio.IOErrorEnum: a message\ntestGErrorMessages@*');
+ try {
+ throw new Gio.IOErrorEnum({ message: 'a message', code: 0 });
+ } catch(e) {
+ logError(e);
+ }
+
+ GLib.test_expect_message('Gjs', GLib.LogLevelFlags.LEVEL_WARNING,
+ 'JS ERROR: Gio.IOErrorEnum: a message\ntestGErrorMessages@*');
+ logError(new Gio.IOErrorEnum({ message: 'a message', code: 0 }));
+
+ // No stack for GLib.Error constructor
+ GLib.test_expect_message('Gjs', GLib.LogLevelFlags.LEVEL_WARNING,
+ 'JS ERROR: Gio.IOErrorEnum: a message');
+ logError(new GLib.Error(Gio.IOErrorEnum, 0, 'a message'));
+
+ GLib.test_expect_message('Gjs', GLib.LogLevelFlags.LEVEL_WARNING,
+ 'JS ERROR: GLib.Error my-error: a message');
+ logError(new GLib.Error(GLib.quark_from_string('my-error'), 0, 'a message'));
+
+ // Now with prefix
+
+ GLib.test_expect_message('Gjs', GLib.LogLevelFlags.LEVEL_WARNING,
+ 'JS ERROR: prefix: Gio.IOErrorEnum: *');
+ try {
+ let file = Gio.file_new_for_path("\\/,.^!@&$_don't exist");
+ file.read(null);
+ } catch(e) {
+ logError(e, 'prefix');
+ }
+
+ GLib.test_expect_message('Gjs', GLib.LogLevelFlags.LEVEL_WARNING,
+ 'JS ERROR: prefix: Gio.IOErrorEnum: a message\ntestGErrorMessages@*');
+ try {
+ throw new Gio.IOErrorEnum({ message: 'a message', code: 0 });
+ } catch(e) {
+ logError(e, 'prefix');
+ }
+
+ GLib.test_expect_message('Gjs', GLib.LogLevelFlags.LEVEL_WARNING,
+ 'JS ERROR: prefix: Gio.IOErrorEnum: a message\ntestGErrorMessages@*');
+ logError(new Gio.IOErrorEnum({ message: 'a message', code: 0 }), 'prefix');
+
+ // No stack for GLib.Error constructor
+ GLib.test_expect_message('Gjs', GLib.LogLevelFlags.LEVEL_WARNING,
+ 'JS ERROR: prefix: Gio.IOErrorEnum: a message');
+ logError(new GLib.Error(Gio.IOErrorEnum, 0, 'a message'), 'prefix');
+
+ GLib.test_expect_message('Gjs', GLib.LogLevelFlags.LEVEL_WARNING,
+ 'JS ERROR: prefix: GLib.Error my-error: a message');
+ logError(new GLib.Error(GLib.quark_from_string('my-error'), 0, 'a message'), 'prefix');
+
+ GLib.test_assert_expected_messages_internal('Gjs', 'testExceptions.js', 0,
+ 'testGErrorMessages');
+}
+
JSUnit.gjstestRun(this, JSUnit.setUp, JSUnit.tearDown);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]