notepad-plus-plus-legacy/PowerEditor/Test/FunctionList/unitTest.ps1
Don HO c0c070abaf
Split functionList.xml into multifile in "functionList" Folder
New "functionList" will be added beside of notepad++.exe or "%APPDATA%\Notepad++\", according the installation mode. If the portable package is used, after removing "doLocalConf.xml", the "functionList" folder should be copied manually from Notepad++ installed directory to "%APPDATA%\Notepad++\" to make function list work again.

All splited files are localized in this folder with the explicit language name.

"overrideMap.xml" is optional for overriding the default functionList parse rule files, and for adding UDL parse rule files.

Close #4896
2020-10-21 18:05:08 +02:00

42 lines
885 B
PowerShell

# This script does 1 unit-test on given relative dir path and on given language.
# Here's its syntax:
# .\unit-test.ps1 RELATIVE_PATH LANG
# It return 0 if result is OK
# -1 if result is KO
# -2 if exception
# 1 if unitTest file not found
$testRoot = ".\"
$dirName=$args[0]
$langName=$args[1]
Try {
if ((Get-Item $testRoot$dirName) -is [System.IO.DirectoryInfo])
{
if (-Not (Test-Path $testRoot$dirName\unitTest))
{
return 1
}
..\..\bin\notepad++.exe -export=functionList -l"$langName" $testRoot$dirName\unitTest | Out-Null
$expectedRes = Get-Content $testRoot$dirName\unitTest.expected.result
$generatedRes = Get-Content $testRoot$dirName\unitTest.result.json
if ($generatedRes -eq $expectedRes)
{
Remove-Item $testRoot$dirName\unitTest.result.json
return 0
}
else
{
return -1
}
}
}
Catch
{
return -2
}