:unittest.extractFileSection

Test cases for the :extractFileSection function

Description: call:unittest.extractFileSection
Dependencies: :extractFileSection
Script:
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
:unittest.extractFileSection
:$created 20080219 :$changed 20100205
:$source https://www.dostips.com
SETLOCAL Disabledelayedexpansion
set "substitute=SUBSTITUTED"
echo.extract without substitution
call:extractFileSection "+++Section1" "+++" "%~f0"
echo.extract with substitution
SETLOCAL Enabledelayedexpansion
call:extractFileSection "+++Section2" "+++" "%~f0"
rem echo.-- extract function %~0
rem call:extractFileSection "%~0" "EXIT /b" "%~f0"
@EXIT /b
+++Section1
    Extracted Line 1
    Extracted Line 2 %substitute%
    a: %~1 %2
    b: %substitute:~3%
    c: %substitute:u=%
+++
+++Section2:S
    Extracted Line 1
    Extracted Line 2 %substitute%
    a: %~1 %2
    b: %substitute:~3%
    c: %substitute:u=%
+++
EXIT /b
Script Output:
 DOS Script Output
---- :unittest.extractFileSection - output
extract without substitution
    Extracted Line 1
    Extracted Line 2 %substitute%
    a: %~1 %2
    b: %substitute:~3%
    c: %substitute:u=%
extract with substitution
    Extracted Line 1
    Extracted Line 2 SUBSTITUTED
    a: +++Section2 "+++"
    b: STITUTED
    c: SBSTITTED
----