[gjs/gnome-3-24] tests: Various GValue test fixes



commit dd95859d5a5d991e55de822231df128c9c0f1f99
Author: Philip Chimento <philip chimento gmail com>
Date:   Mon Apr 3 22:01:02 2017 -0700

    tests: Various GValue test fixes
    
    Consolidate the GValue tests in testEverythingBasic, and fix the name of
    an enum constant in testGIMarshalling (though that test still must be
    skipped.)
    
    https://bugzilla.gnome.org/show_bug.cgi?id=688128

 installed-tests/js/testEverythingBasic.js |   33 +++++++++++++++++++++--------
 installed-tests/js/testGIMarshalling.js   |    2 +-
 2 files changed, 25 insertions(+), 10 deletions(-)
---
diff --git a/installed-tests/js/testEverythingBasic.js b/installed-tests/js/testEverythingBasic.js
index 3b758de..de3ef1a 100644
--- a/installed-tests/js/testEverythingBasic.js
+++ b/installed-tests/js/testEverythingBasic.js
@@ -241,12 +241,31 @@ describe('Life, the Universe and Everything', function () {
         expect(Regress.test_callback_thaw_async()).toEqual(44);
     });
 
-    it('method taking a GValue', function () {
-        expect(Regress.test_int_value_arg(42)).toEqual(42);
-    });
+    describe('GValue boxing and unboxing', function () {
+        it('integer in', function () {
+            expect(Regress.test_int_value_arg(42)).toEqual(42);
+        });
+
+        it('integer out', function () {
+            expect(Regress.test_value_return(42)).toEqual(42);
+        });
+
+        it('strv in', function () {
+            expect(Regress.test_strv_in_gvalue()).toEqual(['one', 'two', 'three']);
+        });
 
-    it('method returning a GValue', function () {
-        expect(Regress.test_value_return(42)).toEqual(42);
+        const GVALUE_HASH_TABLE = {
+            'integer': 12,
+            'boolean': true,
+            'string': 'some text',
+            'strings': ['first', 'second', 'third'],
+            'flags': Regress.TestFlags.FLAG1 | Regress.TestFlags.FLAG3,
+            'enum': Regress.TestEnum.VALUE2,
+        };
+
+        it('hashtable with GValue value type out', function () {
+            expect(Regress.test_ghash_gvalue_return()).toEqual(GVALUE_HASH_TABLE);
+        });
     });
 
     ['glist', 'gslist'].forEach(list => {
@@ -500,10 +519,6 @@ describe('Life, the Universe and Everything', function () {
         });
     });
 
-    it('strv in GValue', function () {
-        expect(Regress.test_strv_in_gvalue()).toEqual(['one', 'two', 'three']);
-    });
-
     // Cannot access the variant contents, for now
     it('integer GVariant', function () {
         let ivar = Regress.test_gvariant_i();
diff --git a/installed-tests/js/testGIMarshalling.js b/installed-tests/js/testGIMarshalling.js
index 501cf41..e71edff 100644
--- a/installed-tests/js/testGIMarshalling.js
+++ b/installed-tests/js/testGIMarshalling.js
@@ -402,7 +402,7 @@ describe('GValue', function () {
     });
 
     xit('enum can be passed into a function and packed', function () {
-        expect(() => GIMarshallingTests.gvalue_in_enum(GIMarshallingTests.Enum.VALUE_3))
+        expect(() => GIMarshallingTests.gvalue_in_enum(GIMarshallingTests.Enum.VALUE3))
             .not.toThrow();
     }).pend("GJS doesn't support native enum types");
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]