From 115867d662672997d8e155b99d71056baea2d1be Mon Sep 17 00:00:00 2001 From: Nasah Kuma Date: Fri, 29 Apr 2022 21:15:08 +0100 Subject: Add check for GObject introspected objects to pretty-print --- installed-tests/js/testPrint.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'installed-tests') diff --git a/installed-tests/js/testPrint.js b/installed-tests/js/testPrint.js index f6d27405..9b582c28 100644 --- a/installed-tests/js/testPrint.js +++ b/installed-tests/js/testPrint.js @@ -3,6 +3,8 @@ // SPDX-FileCopyrightText: 2022 Nasah Kuma const GLib = imports.gi.GLib; +imports.gi.versions.Gdk = '3.0'; +const Gdk = imports.gi.Gdk; describe('print', function () { it('can be spied upon', function () { @@ -142,4 +144,16 @@ describe('prettyPrint', function () { 'JS LOG: { date: 2018-12-24T10:33:30.000Z }'); log({date: new Date(Date.UTC(2018, 11, 24, 10, 33, 30))}); }); + + it('toString is overridden on object', function () { + GLib.test_expect_message('Gjs', GLib.LogLevelFlags.LEVEL_MESSAGE, + 'JS LOG: [boxed instance wrapper GIName:*]'); + log(new Gdk.Rectangle()); + }); + + it('string tag supplied', function () { + GLib.test_expect_message('Gjs', GLib.LogLevelFlags.LEVEL_MESSAGE, + 'JS LOG: [object GIRepositoryNamespace]'); + log(Gdk); + }); }); -- cgit v1.2.1