Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
9b79fd57
Commit
9b79fd57
authored
Aug 26, 2011
by
Frédéric Delanoy
Committed by
Alexandre Julliard
Aug 26, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd/tests: Add variable substitution tests.
parent
c85be8ae
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
172 additions
and
0 deletions
+172
-0
test_builtins.cmd
programs/cmd/tests/test_builtins.cmd
+110
-0
test_builtins.cmd.exp
programs/cmd/tests/test_builtins.cmd.exp
+62
-0
No files found.
programs/cmd/tests/test_builtins.cmd
View file @
9b79fd57
...
...
@@ -227,6 +227,116 @@ echo '%VAR:~-2,-4%'
echo %VAR:~-3,-2%
set VAR=
echo ------------ Testing variable substitution --------------
echo ...in FOR variables
for %%i in ("A B" C) do echo %%i
rem quotes removal
for %%i in ("A B" C) do echo '%%~i'
rem fully qualified path
for %%f in ("C D" E) do echo %%~ff
rem drive letter
for %%i in ("F G" H) do echo %%~di
rem path
for %%d in ("I J" K) do echo %%~pd
rem filename
for %%i in ("L M" N) do echo %%~ni
rem file extension
for %%i in ("O. P.OOL" Q.TABC hello) do echo '%%~xi'
rem path with short path names
for %%I in ("R S" T ABCDEFGHIJK.LMNOP) do echo '%%~sI'
rem file attribute
for %%i in ("U V" W) do echo '%%~ai'
echo foo> foo
for %%i in (foo) do echo '%%~ai'
del foo
rem file date/time
rem Not fully testable, until we can grep dir's output to get foo's creation time in an envvar...
for %%i in ("a b" c) do echo '%%~ti'
rem file size
rem Similar issues as above
for %%i in ("a b" c) do echo '%%~zi'
rem combined options
for %%i in ("d e" f) do echo %%~dpi
for %%i in ("g h" i) do echo %%~sdi
for %%i in ("g h" i) do echo %%~dsi
for %%i in ("j k" l.eh) do echo '%%~xsi'
echo ...in parameters
for %%i in ("A B" C) do call :echoFun %%i
rem quotes removal
for %%i in ("A B" C) do call :echoFunQ %%i
rem fully qualified path
for %%f in ("C D" E) do call :echoFunF %%f
rem drive letter
for %%i in ("F G" H) do call :echoFunD %%i
rem path
for %%d in ("I J" K) do call :echoFunP %%d
rem filename
for %%i in ("L M" N) do call :echoFunN %%i
rem file extension
for %%i in ("O. P.OOL" Q.TABC hello) do call :echoFunX %%i
rem path with short path names
for %%I in ("R S" T ABCDEFGHIJK.LMNOP) do call :echoFunS %%I
rem NT4 aborts whole script execution when encountering ~a, ~t and ~z substitutions, preventing full testing
rem combined options
for %%i in ("d e" f) do call :echoFunDP %%i
for %%i in ("g h" i) do call :echoFunSD %%i
for %%i in ("g h" i) do call :echoFunDS %%i
for %%i in ("j k" l.eh) do call :echoFunXS %%i
goto :endEchoFuns
:echoFun
echo %1
goto :eof
:echoFunQ
echo '%~1'
goto :eof
:echoFunF
echo %~f1
goto :eof
:echoFunD
echo %~d1
goto :eof
:echoFunP
echo %~p1
goto :eof
:echoFunN
echo %~n1
goto :eof
:echoFunX
echo '%~x1'
goto :eof
:echoFunS
rem some NT4 workaround
set VAR='%~s1'
echo %VAR%
set VAR=
goto :eof
:echoFunDP
echo %~dp1
goto :eof
:echoFunSD
echo %~sd1
goto :eof
:echoFunDS
echo %~ds1
goto :eof
:echoFunXS
echo '%~xs1'
goto :eof
:endEchoFuns
echo ------------ Testing variable delayed expansion --------------
rem NT4 doesn't support this
echo ...default mode (load-time expansion)
...
...
programs/cmd/tests/test_builtins.cmd.exp
View file @
9b79fd57
...
...
@@ -213,6 +213,68 @@ ert@or_broken@qwerty
e@or_broken@qwerty
''@or_broken@'qwerty'
r@or_broken@qwerty
------------ Testing variable substitution --------------
...in FOR variables
@todo_wine@"A B"
C
'A B'@or_broken@''
'C'@or_broken@''
@pwd@\C D@or_broken@%~ff
@pwd@\E@or_broken@%~ff
@drive@
@drive@
@path@@or_broken@%~pd
@path@@or_broken@%~pd
L M
N
'.OOL'
'.TABC'
''
@todo_wine@'@drive@@shortpath@R S'@or_broken@''
@todo_wine@'@drive@@shortpath@T'@or_broken@''
@todo_wine@'@drive@@shortpath@ABCDEFGHIJK.LMNOP'@or_broken@''
@todo_wine@''@or_broken@'%~ai'
@todo_wine@''@or_broken@'%~ai'
@todo_wine@'--a------'@or_broken@'%~ai'
@todo_wine@''@or_broken@'%~ti'
@todo_wine@''@or_broken@'%~ti'
@todo_wine@''@or_broken@'%~zi'
@todo_wine@''@or_broken@'%~zi'
@drive@@path@
@drive@@path@
@drive@
@drive@
@drive@
@drive@
''
'.eh'
...in parameters
@todo_wine@"A B"
C
@todo_wine@'A B'@or_broken@''
'C'@or_broken@''
@todo_wine@@pwd@\C D
@pwd@\E
@drive@
@drive@
@path@
@path@
@todo_wine@L M
N
@todo_wine@'.OOL'
'.TABC'
''
@todo_wine@'@drive@@shortpath@R S'@or_broken@''
@todo_wine@'@drive@@shortpath@T'@or_broken@''
@todo_wine@'@drive@@shortpath@ABCDEFGHIJK.LMNOP'@or_broken@''
@drive@@path@
@drive@@path@
@drive@
@drive@
@drive@
@drive@
''
'.eh'@or_broken@''
------------ Testing variable delayed expansion --------------
...default mode (load-time expansion)
foo
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment