${Unless} ${Cmd} ... was not working.

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3293 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
eccles 2003-12-20 15:01:36 +00:00
parent 4998ff6e18
commit bbfd02e585
2 changed files with 18 additions and 9 deletions

View file

@ -137,14 +137,16 @@ Section /o "Run tests" TESTS
DetailPrint "FAILED IfThen test" DetailPrint "FAILED IfThen test"
${EndIf} ${EndIf}
; ifcmd..||..| ; ifcmd..||..| and if/unless cmd
StrCpy $R2 "" StrCpy $R2 ""
${ifcmd} MessageBox MB_YESNO "Please press Yes" IDYES ${||} StrCpy $R2 $R2A ${|} ${ifcmd} MessageBox MB_YESNO "Please press Yes" IDYES ${||} StrCpy $R2 $R2A ${|}
${ifcmd} MessageBox MB_YESNO|MB_DEFBUTTON2 "Please press No" IDYES ${||} StrCpy $R2 $R2B ${|} ${Unless} ${Cmd} `MessageBox MB_YESNO|MB_DEFBUTTON2 "Please press No" IDYES`
${If} $R2 == "A" StrCpy $R2 $R2B
DetailPrint "PASSED IfCmd test" ${EndUnless}
${If} $R2 == "AB"
DetailPrint "PASSED IfCmd/If Cmd test"
${Else} ${Else}
DetailPrint "FAILED IfCmd test" DetailPrint "FAILED IfCmd/If Cmd test"
${EndIf} ${EndIf}
; select..case..case2..case3..case4..case5..caseelse..endselect ; select..case..case2..case3..case4..case5..caseelse..endselect

View file

@ -262,15 +262,22 @@
; "Any instruction" test ; "Any instruction" test
!macro _Cmd _a _b _t _f !macro _Cmd _a _b _t _f
!define _t=${_t} !define _t=${_t}
!ifdef _t= !ifdef _t= ; If no true label then make one
!define __t +2 ; If no jump then make sure we skip the Goto below !define __t _${__LINE__}
!else !else
!define __t ${_t} !define __t ${_t}
!endif !endif
!undef _t=${_t}
${_b} ${__t} ${_b} ${__t}
!define _f=${_f}
!ifndef _f= ; If a false label then go there
Goto ${_f}
!endif
!undef _f=${_f}
!ifdef _t= ; If we made our own true label then place it
${__t}:
!endif
!undef __t !undef __t
Goto ${_f} !undef _t=${_t}
!macroend !macroend
!define Cmd `"" Cmd` !define Cmd `"" Cmd`