[gjs/wip/ptomato/tests: 19/26] tests: Move GVariant overrides test to testGLib.js
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/wip/ptomato/tests: 19/26] tests: Move GVariant overrides test to testGLib.js
- Date: Sun, 18 Dec 2016 07:39:05 +0000 (UTC)
commit 94a60c243e510ab66051f3f89b19f1d8c5185565
Author: Philip Chimento <philip chimento gmail com>
Date: Sat Dec 3 20:58:27 2016 -0800
tests: Move GVariant overrides test to testGLib.js
This didn't really belong in testEverythingEncapsulated, which tests
boxed types from the Regress library. Instead we put it in a new file
which will hold any other tests of GLib overrides added in the future.
https://bugzilla.gnome.org/show_bug.cgi?id=775444
Makefile-test.am | 1 +
installed-tests/js/testEverythingEncapsulated.js | 34 --------------------
installed-tests/js/testGLib.js | 37 ++++++++++++++++++++++
3 files changed, 38 insertions(+), 34 deletions(-)
---
diff --git a/Makefile-test.am b/Makefile-test.am
index e26d078..7bff53e 100644
--- a/Makefile-test.am
+++ b/Makefile-test.am
@@ -245,6 +245,7 @@ common_jstests_files = \
installed-tests/js/testFundamental.js \
installed-tests/js/testGettext.js \
installed-tests/js/testGIMarshalling.js \
+ installed-tests/js/testGLib.js \
installed-tests/js/testGObjectClass.js \
installed-tests/js/testGObjectInterface.js \
installed-tests/js/testGTypeClass.js \
diff --git a/installed-tests/js/testEverythingEncapsulated.js
b/installed-tests/js/testEverythingEncapsulated.js
index 8b375f6..3b7f5be 100644
--- a/installed-tests/js/testEverythingEncapsulated.js
+++ b/installed-tests/js/testEverythingEncapsulated.js
@@ -1,7 +1,6 @@
// This used to be called "Everything"
const JSUnit = imports.jsUnit;
const Everything = imports.gi.Regress;
-const GLib = imports.gi.GLib;
function testStruct() {
let struct = new Everything.TestStructA();
@@ -161,38 +160,5 @@ function testComplexConstructorBackwardCompatibility() {
JSUnit.assertEquals(5, boxed.some_long);
}
-function testVariantConstructor() {
- let str_variant = new GLib.Variant('s', 'mystring');
- JSUnit.assertEquals('mystring', str_variant.get_string()[0]);
- JSUnit.assertEquals('mystring', str_variant.deep_unpack());
-
- let str_variant_old = GLib.Variant.new('s', 'mystring');
- JSUnit.assertTrue(str_variant.equal(str_variant_old));
-
- let struct_variant = new GLib.Variant('(sogvau)',
- [ 'a string',
- '/a/object/path',
- 'asig', //nature
- new GLib.Variant('s', 'variant'),
- [ 7, 3 ]
- ]);
- JSUnit.assertEquals(5, struct_variant.n_children());
-
- let unpacked = struct_variant.deep_unpack();
- JSUnit.assertEquals('a string', unpacked[0]);
- JSUnit.assertEquals('/a/object/path', unpacked[1]);
- JSUnit.assertEquals('asig', unpacked[2]);
- JSUnit.assertTrue(unpacked[3] instanceof GLib.Variant);
- JSUnit.assertEquals('variant', unpacked[3].deep_unpack());
- JSUnit.assertTrue(unpacked[4] instanceof Array);
- JSUnit.assertEquals(2, unpacked[4].length);
-
- let maybe_variant = new GLib.Variant('ms', null);
- JSUnit.assertEquals(null, maybe_variant.deep_unpack());
-
- maybe_variant = new GLib.Variant('ms', 'string');
- JSUnit.assertEquals('string', maybe_variant.deep_unpack());
-}
-
JSUnit.gjstestRun(this, JSUnit.setUp, JSUnit.tearDown);
diff --git a/installed-tests/js/testGLib.js b/installed-tests/js/testGLib.js
new file mode 100644
index 0000000..d66c14e
--- /dev/null
+++ b/installed-tests/js/testGLib.js
@@ -0,0 +1,37 @@
+const GLib = imports.gi.GLib;
+const JSUnit = imports.jsUnit;
+
+function testVariantConstructor() {
+ let str_variant = new GLib.Variant('s', 'mystring');
+ JSUnit.assertEquals('mystring', str_variant.get_string()[0]);
+ JSUnit.assertEquals('mystring', str_variant.deep_unpack());
+
+ let str_variant_old = GLib.Variant.new('s', 'mystring');
+ JSUnit.assertTrue(str_variant.equal(str_variant_old));
+
+ let struct_variant = new GLib.Variant('(sogvau)', [
+ 'a string',
+ '/a/object/path',
+ 'asig', //nature
+ new GLib.Variant('s', 'variant'),
+ [ 7, 3 ]
+ ]);
+ JSUnit.assertEquals(5, struct_variant.n_children());
+
+ let unpacked = struct_variant.deep_unpack();
+ JSUnit.assertEquals('a string', unpacked[0]);
+ JSUnit.assertEquals('/a/object/path', unpacked[1]);
+ JSUnit.assertEquals('asig', unpacked[2]);
+ JSUnit.assertTrue(unpacked[3] instanceof GLib.Variant);
+ JSUnit.assertEquals('variant', unpacked[3].deep_unpack());
+ JSUnit.assertTrue(unpacked[4] instanceof Array);
+ JSUnit.assertEquals(2, unpacked[4].length);
+
+ let maybe_variant = new GLib.Variant('ms', null);
+ JSUnit.assertEquals(null, maybe_variant.deep_unpack());
+
+ maybe_variant = new GLib.Variant('ms', 'string');
+ JSUnit.assertEquals('string', maybe_variant.deep_unpack());
+}
+
+JSUnit.gjstestRun(this, JSUnit.setUp, JSUnit.tearDown);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]