home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 March / CMCD0304.ISO / Software / Freeware / Programare / nullsoft / nsis20.exe / Examples / rtest.nsi < prev    next >
Text File  |  2003-11-19  |  1KB  |  91 lines

  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. ;--------------------------------
  14.  
  15. Section "Test 1"
  16.  
  17.   StrCpy $R0 "a"
  18.   
  19.   GetFunctionAddress $R1 test1
  20.   Call $R1
  21.   
  22.   StrCmp $R0 "a182345678" success
  23.   
  24.   DetailPrint "Test 1 failed (output: $R0)"
  25.   Goto end
  26.   
  27.   success:
  28.   DetailPrint "Test 1 succeded (output: $R0)"
  29.   
  30.   end:
  31.   
  32. SectionEnd
  33.  
  34. Function test1
  35.  
  36.   GetLabelAddress $9 skip
  37.   
  38.   IntOp $9 $9 - 1
  39.   StrCpy $R0 $R01
  40.   
  41.   Call $9
  42.   
  43.   StrCpy $R0 $R02
  44.   StrCpy $R0 $R03
  45.   StrCpy $R0 $R04
  46.   StrCpy $R0 $R05
  47.   StrCpy $R0 $R06
  48.   StrCpy $R0 $R07
  49.   StrCpy $R0 $R08
  50.   
  51.   skip:
  52.   
  53. FunctionEnd
  54.  
  55. ;--------------------------------
  56.  
  57. Section "Test 2"
  58.  
  59.   StrCpy $R0 "0"
  60.   StrCpy $R1 "11"
  61.   
  62.   Call test2
  63.   
  64.   StrCmp $R1 "11,10,9,8,7,6,5,4,3,2,1" success
  65.   
  66.   DetailPrint "Test 2 failed (output: $R1)"
  67.   Goto end
  68.   
  69.   success:
  70.   DetailPrint "Test 2 succeded (output: $R1)"
  71.   
  72.   end:
  73.  
  74. SectionEnd
  75.  
  76. Function test2
  77.  
  78.   IntOp $R0 $R0 + 1
  79.   IntCmp $R0 10 done
  80.   
  81.   Push $R0
  82.   
  83.   GetFunctionAddress $R2 test2
  84.   Call $R2
  85.   
  86.   Pop $R0
  87.   
  88.   done:
  89.   StrCpy $R1 "$R1,$R0"
  90.   
  91. FunctionEnd