:unittest.substitute

Test cases for the :substitute function

Description: call:unittest.substitute
Dependencies: :substitute
Script:
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
:unittest.substitute
:$created 20080326 :$changed 20080326
:$source https://www.dostips.com
(for %%A in (
        "two words"
        "exclamation ! exclamation"
        "percent     %% percent"
        "ampersand   & ampersand && ampersand"
        "vertical    | vertical  || vertical"
        "(parenthesis) (parenthesis)"
        "least    << lesser  < less"
        "greatest >> greater > great"
        "next line is empty"
        ""
        "almost done"
        "last line will have line feed"
    ) do for /f "delims=" %%B in ('"echo."echo.%%~A""') do %%~B
)>"%temp%.\%~n0.unittest.txt"
call:substitute "t" "." "%temp%.\%~n0.unittest.txt"
EXIT /b
Script Output:
 DOS Script Output
---- :unittest.substitute - output
.wo words
exclama.ion ! exclama.ion
percen.     % percen.
ampersand   & ampersand && ampersand
ver.ical    | ver.ical  || ver.ical
(paren.hesis) (paren.hesis)
leas.    << lesser  < less
grea.es. >> grea.er > grea.
nex. line is emp.y

almos. done
las. line will have line feed
----