${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"
${EndIf}
; ifcmd..||..|
; ifcmd..||..| and if/unless cmd
StrCpy $R2 ""
${ifcmd} MessageBox MB_YESNO "Please press Yes" IDYES ${||} StrCpy $R2 $R2A ${|}
${ifcmd} MessageBox MB_YESNO|MB_DEFBUTTON2 "Please press No" IDYES ${||} StrCpy $R2 $R2B ${|}
${If} $R2 == "A"
DetailPrint "PASSED IfCmd test"
${Unless} ${Cmd} `MessageBox MB_YESNO|MB_DEFBUTTON2 "Please press No" IDYES`
StrCpy $R2 $R2B
${EndUnless}
${If} $R2 == "AB"
DetailPrint "PASSED IfCmd/If Cmd test"
${Else}
DetailPrint "FAILED IfCmd test"
DetailPrint "FAILED IfCmd/If Cmd test"
${EndIf}
; select..case..case2..case3..case4..case5..caseelse..endselect

View file

@ -262,15 +262,22 @@
; "Any instruction" test
!macro _Cmd _a _b _t _f
!define _t=${_t}
!ifdef _t=
!define __t +2 ; If no jump then make sure we skip the Goto below
!ifdef _t= ; If no true label then make one
!define __t _${__LINE__}
!else
!define __t ${_t}
!endif
!undef _t=${_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
Goto ${_f}
!undef _t=${_t}
!macroend
!define Cmd `"" Cmd`