root / tmp / org.txm.setups / nsis / Examples / rtest.nsi @ 3136
Historique | Voir | Annoter | Télécharger (1,29 ko)
1 |
; rtest.nsi |
---|---|
2 |
; |
3 |
; This script tests some advanced NSIS functions. |
4 |
|
5 |
;-------------------------------- |
6 |
|
7 |
Name "rtest" |
8 |
OutFile "rtest.exe" |
9 |
|
10 |
ComponentText "Select tests!" |
11 |
ShowInstDetails show |
12 |
|
13 |
RequestExecutionLevel user |
14 |
|
15 |
;-------------------------------- |
16 |
|
17 |
Section "Test 1" |
18 |
|
19 |
StrCpy $R0 "a" |
20 |
|
21 |
GetFunctionAddress $R1 test1 |
22 |
Call $R1 |
23 |
|
24 |
StrCmp $R0 "a182345678" success |
25 |
|
26 |
DetailPrint "Test 1 failed (output: $R0)" |
27 |
Goto end |
28 |
|
29 |
success: |
30 |
DetailPrint "Test 1 succeeded (output: $R0)" |
31 |
|
32 |
end: |
33 |
|
34 |
SectionEnd |
35 |
|
36 |
Function test1 |
37 |
|
38 |
GetLabelAddress $9 skip |
39 |
|
40 |
IntOp $9 $9 - 1 |
41 |
StrCpy $R0 $R01 |
42 |
|
43 |
Call $9 |
44 |
|
45 |
StrCpy $R0 $R02 |
46 |
StrCpy $R0 $R03 |
47 |
StrCpy $R0 $R04 |
48 |
StrCpy $R0 $R05 |
49 |
StrCpy $R0 $R06 |
50 |
StrCpy $R0 $R07 |
51 |
StrCpy $R0 $R08 |
52 |
|
53 |
skip: |
54 |
|
55 |
FunctionEnd |
56 |
|
57 |
;-------------------------------- |
58 |
|
59 |
Section "Test 2" |
60 |
|
61 |
StrCpy $R0 "0" |
62 |
StrCpy $R1 "11" |
63 |
|
64 |
Call test2 |
65 |
|
66 |
StrCmp $R1 "11,10,9,8,7,6,5,4,3,2,1" success |
67 |
|
68 |
DetailPrint "Test 2 failed (output: $R1)" |
69 |
Goto end |
70 |
|
71 |
success: |
72 |
DetailPrint "Test 2 succeeded (output: $R1)" |
73 |
|
74 |
end: |
75 |
|
76 |
SectionEnd |
77 |
|
78 |
Function test2 |
79 |
|
80 |
IntOp $R0 $R0 + 1 |
81 |
IntCmp $R0 10 done |
82 |
|
83 |
Push $R0 |
84 |
|
85 |
GetFunctionAddress $R2 test2 |
86 |
Call $R2 |
87 |
|
88 |
Pop $R0 |
89 |
|
90 |
done: |
91 |
StrCpy $R1 "$R1,$R0" |
92 |
|
93 |
FunctionEnd |