This repository was archived by the owner on Aug 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 225
Expand file tree
/
Copy pathEvalSetRegistry.test
More file actions
69 lines (56 loc) · 2.07 KB
/
EvalSetRegistry.test
File metadata and controls
69 lines (56 loc) · 2.07 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
setup
local tTestKey = "HKEY_CURRENT_USER\Software\LiveCode\Tests\SetRegistry\"
// test setting default value
test setRegistry(tTestKey, "setRegistryTest", "string")
test queryRegistry(tTestKey) is "setRegistryTest"
// test setting named value
test setRegistry(tTestKey & "testValue", "setRegistryTest", "string")
test queryRegistry(tTestKey & "testValue") is "setRegistryTest"
// test clearing value
test setRegistry(tTestKey & "testValue", empty, "string")
test queryRegistry(tTestKey & "testValue") is empty
test the result is "can't find key"
teardown
setup "setting types"
local tTestKey = "HKEY_CURRENT_USER\Software\LiveCode\Tests\SetRegistry\"
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