-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathtst_settings.qml
49 lines (37 loc) · 1.53 KB
/
tst_settings.qml
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
/*
This file is part of Knut.
SPDX-FileCopyrightText: 2024 Klarälvdalens Datakonsult AB, a KDAB Group company <[email protected]>
SPDX-License-Identifier: GPL-3.0-only
Contact KDAB at <[email protected]> for commercial licensing options.
*/
import QtQuick
import Knut
Script {
function test_globalSettings() {
// We can't test the values, as they could change
verify(Settings.hasValue("/lsp/servers/0/arguments"))
verify(Settings.hasValue("/lsp/servers/0/program"))
verify(!Settings.hasValue("/foo/bar"))
// Test missing '/'
verify(Settings.hasValue("lsp/servers/0/arguments"))
verify(Settings.hasValue("lsp/servers/0/program"))
verify(!Settings.hasValue("foo/bar"))
}
function test_projectSettings() {
verify(Settings.hasValue("/foobar/foo"))
compare(Settings.value("/lsp/servers/0/program"), "notclangd")
compare(Settings.value("/lsp/servers/0/arguments"), ["foo", "bar"])
compare(Settings.value("/answer"), 42)
compare(Settings.value("/pi"), 3.14)
compare(Settings.value("/colors"), ["red", "green", "blue"]);
// Test missing '/'
compare(Settings.value("enabled"), true);
compare(Settings.value("foo"), "bar");
// Test missing values
compare(Settings.value("/bar", "default"), "default");
compare(Settings.value("/baz", 1), 1);
// Test values we can't parse
verify(Settings.hasValue("/numbers"));
compare(Settings.value("/numbers"), undefined);
}
}