Update Windows grep test script in line with the non-Windows version.

This commit is contained in:
Philip.Hazel 2017-02-14 10:29:00 +00:00
parent 36973c012b
commit f19d6e1a35
2 changed files with 24 additions and 9 deletions

View File

@ -2,8 +2,8 @@ Change Log for PCRE2
--------------------
Version 10.23 16-January-2017
-----------------------------
Version 10.23 14-February-2017
------------------------------
1. Extended pcre2test with the utf8_input modifier so that it is able to
generate all possible 16-bit and 32-bit code unit values in non-UTF modes.
@ -357,6 +357,10 @@ mode with --only-matching matched several lines, it restarted scanning at the
next line instead of moving on to the end of the matched string, which can be
several lines after the start.
56. Applied Jason Hood's new patch for RunGrepTest.bat that updates it in line
with updates to the non-Windows version.
Version 10.22 29-July-2016
--------------------------

View File

@ -11,6 +11,8 @@ setlocal enabledelayedexpansion
set PCRE2GREP_COLOUR=
set PCRE2GREP_COLOR=
set PCREGREP_COLOUR=
set PCREGREP_COLOR=
set GREP_COLORS=
set GREP_COLOR=
@ -78,6 +80,12 @@ if NOT "%nl%" == "LF" if NOT "%nl%" == "ANY" if NOT "%nl%" == "ANYCRLF" (
echo Default newline setting forced to LF
)
:: Create a simple printf via cscript/JScript (an actual printf may translate
:: LF to CRLF, which this one does not).
echo WScript.StdOut.Write(WScript.Arguments(0).replace(/\\r/g, "\r").replace(/\\n/g, "\n")) >printf.js
set printf=cscript //nologo printf.js
:: ------ Normal tests ------
echo Testing pcre2grep main features
@ -572,6 +580,11 @@ echo ---------------------------- Test 118 ----------------------------->>testtr
(pushd %srcdir% & %pcre2grep% -tL "the" testdata/grepinput* & popd) >>testtrygrep
echo RC=^%ERRORLEVEL%>>testtrygrep
echo ---------------------------- Test 119 ----------------------------->>testtrygrep
%printf% "123\n456\n789\n---abc\ndef\nxyz\n---\n" >testNinputgrep
%pcre2grep% -Mo "(\n|[^-])*---" testNinputgrep >>testtrygrep
echo RC=^%ERRORLEVEL%>>testtrygrep
:: Now compare the results.
%cf% %srcdir%\testdata\grepoutput testtrygrep %cfout%
@ -607,12 +620,10 @@ if %utf8% neq 0 (
:: newline settings will work in environments where the normal newline sequence
:: is not \n. Do not use exported files, whose line endings might be changed.
:: Instead, create an input file so that its contents are exactly what we want.
:: Note the messy fudge to create the input file. These tests are run in the
:: build directory.
:: These tests are run in the build directory.
echo Testing pcre2grep newline settings
echo WScript.StdOut.Write(WScript.Arguments(0).replace(/\\r/g, "\r").replace(/\\n/g, "\n")) >testprint.js
cscript //nologo testprint.js "abc\rdef\r\nghi\njkl" >testNinputgrep
%printf% "abc\rdef\r\nghi\njkl" >testNinputgrep
echo ---------------------------- Test N1 ------------------------------>testtrygrep
%pcre2grep% -n -N CR "^(abc|def|ghi|jkl)" testNinputgrep >>testtrygrep
@ -621,7 +632,7 @@ echo ---------------------------- Test N2 ------------------------------>>testtr
%pcre2grep% -n --newline=crlf "^(abc|def|ghi|jkl)" testNinputgrep >>testtrygrep
echo ---------------------------- Test N3 ------------------------------>>testtrygrep
for /f %%a in ('cscript //nologo testprint.js "def\rjkl"') do set pattern=%%a
for /f %%a in ('%printf% "def\rjkl"') do set pattern=%%a
%pcre2grep% -n --newline=cr -F "!pattern!" testNinputgrep >>testtrygrep
echo ---------------------------- Test N4 ------------------------------>>testtrygrep
@ -654,13 +665,13 @@ if %ERRORLEVEL% equ 0 (
:: is not checked.
echo Testing miscellaneous pcre2grep arguments (unchecked)
cscript //nologo testprint.js "" >testtrygrep
%printf% "" >testtrygrep
call :checkspecial "-xxxxx" 2 || exit /b 1
call :checkspecial "--help" 0 || exit /b 1
call :checkspecial "--line-buffered --colour=auto abc nul" 1 || exit /b 1
:: Clean up local working files
del testcf testprint.js testNinputgrep teststderrgrep testtrygrep testtemp1grep testtemp2grep
del testcf printf.js testNinputgrep teststderrgrep testtrygrep testtemp1grep testtemp2grep
exit /b 0