notepad-plus-plus-legacy/PowerEditor/Test/FunctionList/unitTestLauncher.ps1
Don HO 56e4290501 Add the ability to have more than 1 unit-test per language
For function list, each language can have 2 or mor unit-test files.
The 2nd added unit-test file should be added in a sub-directory, the 3rd added unit-test file should be added into anather sub-directory, and so on.
2020-08-31 04:21:32 +02:00

56 lines
1.2 KiB
PowerShell

$testRoot = ".\"
Get-ChildItem $testRoot -Filter *.* |
Foreach-Object {
if ((Get-Item $testRoot$_) -is [System.IO.DirectoryInfo])
{
$dirName = (Get-Item $testRoot$_).Name
$langName = $dirName
$result = &.\unitTest.ps1 $dirName $langName
if ($result -eq 0)
{
"$dirName ... OK"
}
elseif ($result -eq 1)
{
"$dirName ... unitTest file not found. Test skipt."
}
else
{
"$dirName ... KO"
""
"There are some problems in your functionList.xml"
exit -1
}
# Check all Sub-directories for other unit-tests
Get-ChildItem $testRoot$dirName -Filter *.* |
Foreach-Object {
if ((Get-Item $testRoot$dirName\$_) -is [System.IO.DirectoryInfo])
{
$subDirName = (Get-Item $testRoot$dirName\$_).Name
$subResult = &.\unitTest.ps1 $langName\$subDirName $langName
if ($subResult -eq 0)
{
"$dirName-$subDirName ... OK"
}
elseif ($subResult -eq 1)
{
"$dirName-$subDirName ... unitTest file not found. Test skipt."
}
else
{
"$dirName-$subDirName ... KO"
""
"There are some problems in your functionList.xml"
exit -1
}
}
}
}
}
""
"All tests are passed."
exit 0