From 4b72654ff308960e28f6a63c08c2a5352cbebc90 Mon Sep 17 00:00:00 2001 From: "Denis Kuzmin (github/3F)" Date: Mon, 12 Feb 2024 23:52:22 +0300 Subject: [PATCH] Fixed `ESC`T/L/E .../p:Platform="Any CPU" CPU"" was unexpected at this time. --- frontend.bat | 18 +++++++------- tests/keysAndLogicTests.bat | 47 +++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 9 deletions(-) diff --git a/frontend.bat b/frontend.bat index a662c4b..256d2fa 100644 --- a/frontend.bat +++ b/frontend.bat @@ -29,8 +29,8 @@ if not defined __p_call set args=%args:^=^^% :: # hMSBuild ^^ - ^^ :: PARSER NOTE: keep \r\n because `&` requires enableDelayedExpansion -set esc=%args:!=L% ::&: -set esc=%esc:^=T% ::&: +set esc=%args:!= L % ::&: +set esc=%esc:^= T % ::&: setlocal enableDelayedExpansion :: https://github.com/3F/hMSBuild/issues/7 @@ -374,9 +374,9 @@ set /a "idx+=1" & if %idx% LSS !amax! goto loopargs :: We don't need double quotes (e.g. set "msbargs=...") because this should already :: contain special symbols inside "..." (e.g. /p:prop="..."). - set msbargs=%msbargs:T=^% ::&: - set msbargs=%msbargs:L=^!% ::&: - set msbargs=!msbargs:E==! ::&: + set msbargs=%msbargs: T =^% ::&: + set msbargs=%msbargs: L =^!% ::&: + set msbargs=!msbargs: E ==! ::&: :_msbargs call :dbgprint "Arguments: " msbargs @@ -723,7 +723,7 @@ exit /B 0 call :nqa %1 !_ieqargs! %3 & exit /B 0 - ) else set _ieqargs=%%aE%%b + ) else set _ieqargs=%%a E %%b ) goto _eqp :nqa @@ -755,9 +755,9 @@ exit /B 0 :: data from %..% below should not contain double quotes, thus we need to protect this: - set "_vl=%_vl:T=^%" ::&: - set "_vl=%_vl:L=^!%" ::&: - set _vl=!_vl:E==! ::&: + set "_vl=%_vl: T =^%" ::&: + set "_vl=%_vl: L =^!%" ::&: + set _vl=!_vl: E ==! ::&: set %2=!_vl! exit /B 0 diff --git a/tests/keysAndLogicTests.bat b/tests/keysAndLogicTests.bat index c32c0ca..b022941 100644 --- a/tests/keysAndLogicTests.bat +++ b/tests/keysAndLogicTests.bat @@ -93,6 +93,53 @@ set "exec=%~3" & set "wdir=%~4" ::_____________________________________________________ + ::_______ ------ ______________________________________ + + call a startTest "-debug /p:Platform=`Any CPU` " 1 || goto x + call a findInStreamOrFail "Arguments:" 4,n || goto x + call a msgOrFailAt !n! "/p:Platform" || goto x + call a msgOrFailAt !n! "`Any CPU`" || goto x + call a completeTest + ::_____________________________________________________ + + + ::_______ ------ ______________________________________ + + call a startTest "-debug -only-path /p:Platform=`Any CPU` " || goto x + call a msgOrFailAt 1 "non-handled key: /p:Platform" || goto x + call a msgOrFailAt 2 "non-handled key: " || goto x + call a msgOrFailAt 3 "non-handled key: `Any CPU`" || goto x + call a completeTest + ::_____________________________________________________ + + + ::_______ ------ ______________________________________ + + call a startTest "-debug /p:Configuration=`Public Release` " 1 || goto x + call a findInStreamOrFail "Arguments:" 4,n || goto x + call a msgOrFailAt !n! "/p:Configuration" || goto x + call a msgOrFailAt !n! "`Public Release`" || goto x + call a completeTest + ::_____________________________________________________ + + + ::_______ ------ ______________________________________ + + call a startTest "-debug /p:Configuration=`Public Release` /p:Platform=`Any CPU`" 1 || goto x + call a msgOrFailAt 1 "non-handled key: /p:Configuration" || goto x + call a msgOrFailAt 2 "non-handled key: " || goto x + call a msgOrFailAt 3 "non-handled key: `Public Release`" || goto x + call a msgOrFailAt 4 "non-handled key: /p:Platform" || goto x + call a msgOrFailAt 5 "non-handled key: " || goto x + call a msgOrFailAt 6 "non-handled key: `Any CPU`" || goto x + call a findInStreamOrFail "Arguments:" 7,n || goto x + call a msgOrFailAt !n! "/p:Configuration" || goto x + call a msgOrFailAt !n! "`Public Release` /p:Platform" || goto x + call a msgOrFailAt !n! "`Any CPU`" || goto x + call a completeTest + ::_____________________________________________________ + + ::::::::::::: call :cleanup