diff options
author | Nasah Kuma <nasahnash19@gmail.com> | 2022-03-22 19:49:07 +0100 |
---|---|---|
committer | Nasah Kuma <nasahnash19@gmail.com> | 2022-03-23 18:05:22 +0100 |
commit | fbd0bb6b8d417520faacb15ee9ffde6f6d176923 (patch) | |
tree | 74e9e973c08e1c7bec7e60861050370fed21d881 | |
parent | a571f4cc705fbd94068e7ecbfe7b4ea818c70c3d (diff) | |
download | gjs-fbd0bb6b8d417520faacb15ee9ffde6f6d176923.tar.gz |
added various test cases for this enhancement
-rw-r--r-- | installed-tests/js/testPrint.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/installed-tests/js/testPrint.js b/installed-tests/js/testPrint.js index 50a4ebc2..f6d27405 100644 --- a/installed-tests/js/testPrint.js +++ b/installed-tests/js/testPrint.js @@ -48,12 +48,29 @@ describe('prettyPrint', function () { log({greeting: 'hi'}); }); + it('property value is object reference', function () { + GLib.test_expect_message('Gjs', GLib.LogLevelFlags.LEVEL_MESSAGE, + 'JS LOG: { a: 5, b: [Circular] }'); + let obj = {a: 5}; + obj.b = obj; + log(obj); + }); + it('more than one property', function () { GLib.test_expect_message('Gjs', GLib.LogLevelFlags.LEVEL_MESSAGE, 'JS LOG: { a: 1, b: 2, c: 3 }'); log({a: 1, b: 2, c: 3}); }); + it('add property value after property value object reference', function () { + GLib.test_expect_message('Gjs', GLib.LogLevelFlags.LEVEL_MESSAGE, + 'JS LOG: { a: 5, b: [Circular], c: 4 }'); + let obj = {a: 5}; + obj.b = obj; + obj.c = 4; + log(obj); + }); + it('array', function () { GLib.test_expect_message('Gjs', GLib.LogLevelFlags.LEVEL_MESSAGE, 'JS LOG: [1, 2, 3, 4, 5]'); @@ -66,6 +83,24 @@ describe('prettyPrint', function () { log({arr: [1, 2, 3, 4, 5]}); }); + it('array reference is the only array element', function () { + GLib.test_expect_message('Gjs', GLib.LogLevelFlags.LEVEL_MESSAGE, + 'JS LOG: [[Circular]]'); + let arr = []; + arr.push(arr); + log(arr); + }); + + it('array reference is one of multiple array elements', function () { + GLib.test_expect_message('Gjs', GLib.LogLevelFlags.LEVEL_MESSAGE, + 'JS LOG: [4, [Circular], 5]'); + let arr = []; + arr.push(4); + arr.push(arr); + arr.push(5); + log(arr); + }); + it('nested array', function () { GLib.test_expect_message('Gjs', GLib.LogLevelFlags.LEVEL_MESSAGE, 'JS LOG: [1, 2, [3, 4], 5]'); |