From 5da4b54e98065a10f97d458a7501fae544be46dd Mon Sep 17 00:00:00 2001 From: kichik Date: Fri, 10 Oct 2008 20:46:09 +0000 Subject: [PATCH] some real tests for GetParameters git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@5746 212acab6-be3b-0410-9dea-997c60f758d6 --- Examples/FileFuncTest.nsi | 53 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/Examples/FileFuncTest.nsi b/Examples/FileFuncTest.nsi index 5fbda3d9..569a4ab5 100644 --- a/Examples/FileFuncTest.nsi +++ b/Examples/FileFuncTest.nsi @@ -22,6 +22,7 @@ Var OUT6 Var OUT7 !include "FileFunc.nsh" +!include "LogicLib.nsh" !insertmacro Locate !insertmacro GetSize @@ -240,7 +241,59 @@ SectionEnd Section GetParameters ${StackVerificationStart} GetParameters + # basic stuff + + StrCpy $CMDLINE '"$PROGRAMFILES\Something\Hello.exe"' ${GetParameters} $OUT1 + StrCpy $CMDLINE '"$PROGRAMFILES\Something\Hello.exe" test' + ${GetParameters} $OUT2 + StrCpy $CMDLINE '"$PROGRAMFILES\Something\Hello.exe" "test"' + ${GetParameters} $OUT3 + StrCpy $CMDLINE 'C:\Hello.exe' + ${GetParameters} $OUT4 + StrCpy $CMDLINE 'C:\Hello.exe test' + ${GetParameters} $OUT5 + StrCpy $CMDLINE 'C:\Hello.exe "test"' + ${GetParameters} $OUT6 + StrCpy $CMDLINE 'C:\Hello.exe test test ' + ${GetParameters} $OUT7 + + ${If} $OUT1 != "" + ${OrIf} $OUT2 != "test" + ${OrIf} $OUT3 != '"test"' + ${OrIf} $OUT4 != "" + ${OrIf} $OUT5 != "test" + ${OrIf} $OUT6 != '"test"' + ${OrIf} $OUT7 != 'test test' + SetErrors + ${EndIf} + + # some corner cases + + StrCpy $CMDLINE '' + ${GetParameters} $OUT1 + StrCpy $CMDLINE '"' + ${GetParameters} $OUT2 + StrCpy $CMDLINE '""' + ${GetParameters} $OUT3 + StrCpy $CMDLINE '"" test' + ${GetParameters} $OUT4 + StrCpy $CMDLINE ' test' + ${GetParameters} $OUT5 + StrCpy $CMDLINE ' test' + ${GetParameters} $OUT6 + StrCpy $CMDLINE ' ' + ${GetParameters} $OUT7 + + ${If} $OUT1 != "" + ${OrIf} $OUT2 != "" + ${OrIf} $OUT3 != "" + ${OrIf} $OUT4 != "" + ${OrIf} $OUT5 != "" + ${OrIf} $OUT6 != "" + ${OrIf} $OUT7 != "" + SetErrors + ${EndIf} ${StackVerificationEnd} SectionEnd