mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 11:11:44 +00:00
Add a testing suite for CMD based on CMD scripts.
Of course, ReactOS' cmd doesn't work at all with the framework at the moment :-) Some tests were taken from "seta_test.cmd" by Royce. (see file headers) svn path=/trunk/; revision=33560
This commit is contained in:
parent
a5d311777a
commit
b655fc4f5e
7 changed files with 337 additions and 0 deletions
69
rostests/win32/cmd/script_testsuite/lib/testlib.cmd
Normal file
69
rostests/win32/cmd/script_testsuite/lib/testlib.cmd
Normal file
|
@ -0,0 +1,69 @@
|
|||
::
|
||||
:: PROJECT: ReactOS CMD Testing Suite
|
||||
:: LICENSE: GPL v2 or any later version
|
||||
:: FILE: lib/testlib.cmd
|
||||
:: PURPOSE: Library with functions available for all tests
|
||||
:: COPYRIGHT: Copyright 2008 Colin Finck <mail@colinfinck.de>
|
||||
::
|
||||
|
||||
:: Indicate that a test ran successfully
|
||||
:_successful
|
||||
set /a test_count+=1
|
||||
set /a successful_tests+=1
|
||||
goto :EOF
|
||||
|
||||
|
||||
:: Indicate that a test failed
|
||||
:: @param 1 Description of the test that failed
|
||||
:_failed
|
||||
set /a test_count+=1
|
||||
set /a failed_tests+=1
|
||||
echo Test "%~1" failed!
|
||||
goto :EOF
|
||||
|
||||
|
||||
:: Test whether a call succeeded
|
||||
:: @param 1 The test command to run and check
|
||||
:_test
|
||||
%~1
|
||||
|
||||
if "%errorlevel%" == "0" (
|
||||
call :_successful
|
||||
) else (
|
||||
call :_failed "%~1"
|
||||
)
|
||||
goto :EOF
|
||||
|
||||
|
||||
:: Test whether a call failed
|
||||
:: @param 1 The test command to run and check
|
||||
:_testnot
|
||||
%~1
|
||||
|
||||
if "%errorlevel%" == "0" (
|
||||
call :_failed "%~1"
|
||||
) else (
|
||||
call :_successful
|
||||
)
|
||||
goto :EOF
|
||||
|
||||
|
||||
:: Test the value of a variable
|
||||
:: @param 1 The variable to check (like %test%)
|
||||
:: @param 2 The variable name (like test)
|
||||
:: @param 3 The expected result (like 5)
|
||||
:: If this parameter wasn't given, _testvar checks if the variable is not ""
|
||||
:_testvar
|
||||
if "%~3" == "" (
|
||||
set testvar_operator=not
|
||||
) else (
|
||||
set testvar_operator=
|
||||
)
|
||||
|
||||
if %testvar_operator% "%~1" == "%~3" (
|
||||
call :_successful
|
||||
) else (
|
||||
call :_failed "if %%~2%% == %~3, actual result was %~1"
|
||||
)
|
||||
|
||||
goto :EOF
|
Loading…
Add table
Add a link
Reference in a new issue