1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
// SPDX-License-Identifier: MIT OR LGPL-2.0-or-later
// SPDX-FileCopyrightText: 2013 Pavel Vasin <rat4vier@gmail.com>
// SPDX-FileCopyrightText: 2013 Giovanni Campagna <gcampagna@src.gnome.org>
// SPDX-FileCopyrightText: 2017 Claudio André <claudioandre.br@gmail.com>
// SPDX-FileCopyrightText: 2019 Philip Chimento <philip.chimento@gmail.com>
// SPDX-FileCopyrightText: 2019 Canonical, Ltd.
const System = imports.system;
const GObject = imports.gi.GObject;
describe('System.addressOf()', function () {
it('gives different results for different objects', function () {
let a = {some: 'object'};
let b = {different: 'object'};
expect(System.addressOf(a)).not.toEqual(System.addressOf(b));
});
});
describe('System.version', function () {
it('gives a plausible number', function () {
expect(System.version).not.toBeLessThan(14700);
expect(System.version).toBeLessThan(20000);
});
});
describe('System.refcount()', function () {
it('gives the correct number', function () {
let o = new GObject.Object({});
expect(System.refcount(o)).toEqual(1);
});
});
describe('System.addressOfGObject()', function () {
it('gives different results for different objects', function () {
let a = new GObject.Object({});
let b = new GObject.Object({});
expect(System.addressOfGObject(a)).toEqual(System.addressOfGObject(a));
expect(System.addressOfGObject(a)).not.toEqual(System.addressOfGObject(b));
});
it('throws for non GObject objects', function () {
expect(() => System.addressOfGObject({}))
.toThrowError(/Object 0x[a-f0-9]+ is not a GObject/);
});
});
describe('System.gc()', function () {
it('does not crash the application', function () {
expect(System.gc).not.toThrow();
});
});
describe('System.dumpHeap()', function () {
it('throws but does not crash when given a nonexistent path', function () {
expect(() => System.dumpHeap('/does/not/exist')).toThrow();
});
});
|