rtest.nsi 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. ; rtest.nsi
  2. ;
  3. ; This script tests some advanced NSIS functions.
  4. ;--------------------------------
  5. Name "rtest"
  6. OutFile "rtest.exe"
  7. ComponentText "Select tests!"
  8. ShowInstDetails show
  9. RequestExecutionLevel user
  10. ;--------------------------------
  11. Section "Test 1"
  12. StrCpy $R0 "a"
  13. GetFunctionAddress $R1 test1
  14. Call $R1
  15. StrCmp $R0 "a182345678" success
  16. DetailPrint "Test 1 failed (output: $R0)"
  17. Goto end
  18. success:
  19. DetailPrint "Test 1 succeeded (output: $R0)"
  20. end:
  21. SectionEnd
  22. Function test1
  23. GetLabelAddress $9 skip
  24. IntOp $9 $9 - 1
  25. StrCpy $R0 $R01
  26. Call $9
  27. StrCpy $R0 $R02
  28. StrCpy $R0 $R03
  29. StrCpy $R0 $R04
  30. StrCpy $R0 $R05
  31. StrCpy $R0 $R06
  32. StrCpy $R0 $R07
  33. StrCpy $R0 $R08
  34. skip:
  35. FunctionEnd
  36. ;--------------------------------
  37. Section "Test 2"
  38. StrCpy $R0 "0"
  39. StrCpy $R1 "11"
  40. Call test2
  41. StrCmp $R1 "11,10,9,8,7,6,5,4,3,2,1" success
  42. DetailPrint "Test 2 failed (output: $R1)"
  43. Goto end
  44. success:
  45. DetailPrint "Test 2 succeeded (output: $R1)"
  46. end:
  47. SectionEnd
  48. Function test2
  49. IntOp $R0 $R0 + 1
  50. IntCmp $R0 10 done
  51. Push $R0
  52. GetFunctionAddress $R2 test2
  53. Call $R2
  54. Pop $R0
  55. done:
  56. StrCpy $R1 "$R1,$R0"
  57. FunctionEnd