forked from livecode/livecode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEvalQueryRegistry.test
More file actions
75 lines (60 loc) · 2.19 KB
/
Copy pathEvalQueryRegistry.test
File metadata and controls
75 lines (60 loc) · 2.19 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
setup
local tTestKey = "HKEY_CURRENT_USER\Software\LiveCode\Tests\QueryRegistry\"
// test querying default value
test setRegistry(tTestKey, "queryRegistryTest", "string")
test queryRegistry(tTestKey) is "queryRegistryTest"
// test querying named value
test setRegistry(tTestKey & "testValue", "queryRegistryTest", "string")
test queryRegistry(tTestKey & "testValue") is "queryRegistryTest"
// test querying non-existant value
test queryRegistry(tTestKey & "nonExistantValue") is empty
test the result is "can't find key"
// delete test key
test deleteRegistry(tTestKey)
// querying non-existant key
test queryRegistry(tTestKey) is empty
test the result is "bad key"
teardown
setup "querying types"
local tTestKey = "HKEY_CURRENT_USER\Software\LiveCode\Tests\QueryRegistry\"
local tTypeTestKey
put tTestKey & "typeTest" into tTypeTestKey
local tType
// test string types
test setRegistry(tTypeTestKey, "a string", "string")
test queryRegistry(tTypeTestKey, tType) is "a string"
test tType is "string"
test setRegistry(tTypeTestKey, "a string", "sz")
test queryRegistry(tTypeTestKey, tType) is "a string"
test tType is "string"
test setRegistry(tTypeTestKey, "%PATH%", "expandsz")
test queryRegistry(tTypeTestKey, tType) is "%PATH%"
test tType is "expandsz"
local tMultiSz
put "string 1" & null & "string 2" & null into tMulti
test setRegistry(tTypeTestKey, tMulti, "multisz")
test queryRegistry(tTypeTestKey, tType) is tMulti
test tType is "multisz"
// binary type
local tBin
repeat with i = 1 to 1000
put numtobyte(random(256) - 1) after tBin
end repeat
test setRegistry(tTypeTestKey, tBin, "binary")
test queryRegistry(tTypeTestKey, tType) is tBin
test tType is "binary"
// dword types
local tdword
put binaryEncode("i1", 1234567) into tdword
test setRegistry(tTypeTestKey, tdword, "dword")
test queryRegistry(tTypeTestKey, tType) is tdword
test tType is "dword"
put binaryEncode("i1", 1234567) into tdword
test setRegistry(tTypeTestKey, tdword, "dwordlittleendian")
test queryRegistry(tTypeTestKey, tType) is tdword
test tType is "dword"
put binaryEncode("N1", 1234567) into tdword
test setRegistry(tTypeTestKey, tdword, "dwordbigendian")
test queryRegistry(tTypeTestKey, tType) is tdword
test tType is "dwordbigendian"
teardown