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.
This commit is contained in:
parent
e72d4855de
commit
56e4290501
1
PowerEditor/Test/FunctionList/cpp/1/unitTest.result.json
Normal file
1
PowerEditor/Test/FunctionList/cpp/1/unitTest.result.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"leaves":["test42","swap","operator+","operator-","operator!","operator~","operator+","operator-","operator*","operator%","operator^","operator&","operator|","operator<<","operator>>","operator&&","operator||","operator<=>","operator==","operator!=","operator<","operator<=","operator>","operator>=","operator<<","operator>>","swap","test_with_functor","main"],"nodes":[{"leaves":["test"],"name":"TestA1"},{"leaves":["test"],"name":"test::TestA2"},{"leaves":["test"],"name":"TestA3"},{"leaves":["test"],"name":"TestA4"},{"leaves":["test"],"name":"TestA5"},{"leaves":["test"],"name":"TestA6"},{"leaves":["test"],"name":"TestA7"},{"leaves":["test"],"name":"TestA8"},{"leaves":["test"],"name":"TestA9"},{"leaves":["test"],"name":"TestA10"},{"leaves":["test"],"name":"TestA11"},{"leaves":["test"],"name":"test::TestA12"},{"leaves":["test"],"name":"TestA13"},{"leaves":["test"],"name":"TestB1"},{"leaves":["test"],"name":"TestB2"},{"leaves":["test"],"name":"test::TestB3"},{"leaves":["test"],"name":"TestB4"},{"leaves":["test"],"name":"TestB5"},{"leaves":["test"],"name":"TestB6"},{"leaves":["test"],"name":"TestB7"},{"leaves":["test"],"name":"TestB8"},{"leaves":["test"],"name":"TestB9"},{"leaves":["test"],"name":"TestB10"},{"leaves":["test"],"name":"TestB11"},{"leaves":["test"],"name":"TestB12"},{"leaves":["test"],"name":"TestB13"},{"leaves":["test1","test2","test3"],"name":"TestC1"},{"leaves":["test1","test2","test3","test4"],"name":"TestC2"},{"leaves":["test1","test2"],"name":"TestC3"},{"leaves":["test"],"name":"TestD1"},{"leaves":["test"],"name":"TestD2"},{"leaves":["test"],"name":"test::TestD3"},{"leaves":["test"],"name":"TestD4"},{"leaves":["operator bool","operator double","operator unsigned int","swap","operator=","operator+=","operator-=","operator*=","operator%=","operator^=","operator&=","operator|=","operator<<=","operator>>=","operator++","operator++","operator--","operator--","operator+","operator-","operator!","operator~","operator+","operator-","operator*","operator%","operator^","operator&","operator|","operator<<","operator>>","operator&&","operator||","operator<=>","operator==","operator!=","operator<","operator<=","operator>","operator>=","operator<<","operator>>","operator[]","operator[]","operator()","operator*","operator->","test1","test2","test3","test4"],"name":"TestE1"},{"leaves":["test3"],"name":"TestE2"},{"leaves":["test"],"name":"TestH1"},{"leaves":["test"],"name":"TestH2"},{"leaves":["test"],"name":"test::TestH3"},{"leaves":["test"],"name":"TestH4"},{"leaves":["test"],"name":"TestH5"},{"leaves":["coalesce","coalesce","compare","divide","equals","cast","minus","modulus","multiply","negate","isnot","isnull","plus","print"],"name":"test"},{"leaves":["operator bool","operator double","operator unsigned int","operator=","operator+=","operator-=","operator*=","operator%=","operator^=","operator&=","operator|=","operator<<=","operator>>=","operator++","operator++","operator--","operator--","operator[]","operator[]","operator()","operator*","operator->","test1","test2","test3","test4"],"name":"TestF1"},{"leaves":["operator bool","operator unsigned int","operator Type","operator=","test1","test2","test3","test4"],"name":"TestG1"}],"root":"unitTest"}
|
@ -1 +1 @@
|
|||||||
{"leaves":["strVal","decStrVal","hexStrVal","getKwClassFromName","getAsciiLenFromBase64Len","base64ToAscii","cutString","RGB2int","convertIntToFormatType"],"nodes":[{"leaves":["getLangFromXmlFileName","getXmlFilePathFromLangName","addLanguageFromXml","switchToLang"],"name":"LocalizationSwitcher"},{"leaves":["getThemeFromXmlFileName"],"name":"ThemeSwitcher"},{"leaves":["getWindowsVersion","reloadStylers","reloadLang","getSpecialFolderLocation","getSettingsFolder","load","destroyInstance","saveConfig_xml","setWorkSpaceFilePath","removeTransparent","SetTransparent","isExistingExternalLangName","getUserDefinedLangNameFromExt","getExternalLangIndexFromName","getULCFromName","getCurLineHilitingColour","setCurLineHilitingColour","setFontList","isInFontList","getLangKeywordsFromXmlTree","getExternalLexerFromXmlTree","addExternalLangToEnd","getUserStylersFromXmlTree","getUserParametersFromXmlTree","getUserDefineLangsFromXmlTree","getShortcutsFromXmlTree","getMacrosFromXmlTree","getUserCmdsFromXmlTree","getPluginCmdsFromXmlTree","getScintKeysFromXmlTree","getBlackListFromXmlTree","initMenuKeys","initScintillaKeys","reloadContextMenuFromXmlTree","getCmdIdFromMenuEntryItemName","getPluginCmdIdFromMenuEntryItemName","getContextMenuFromXmlTree","setWorkingDir","loadSession","getSessionFromXmlTree","feedFileListParameters","feedProjectPanelsParameters","feedFileBrowserParameters","feedFindHistoryParameters","feedShortcut","feedMacros","getActions","feedUserCmds","feedPluginCustomizedCmds","feedScintKeys","feedBlacklist","getShortcuts","feedUserLang","importUDLFromFile","exportUDLToFile","getLangFromExt","setCloudChoice","removeCloudChoice","isCloudPathChanged","writeSettingsFilesOnCloudForThe1stTime","writeUserDefinedLang","insertCmd","insertMacro","insertUserCmd","insertPluginCmd","insertScintKey","writeSession","writeShortcuts","addUserLangToEnd","removeUserLang","feedUserSettings","feedUserKeywordList","feedUserStyles","feedStylerArray","writeRecentFileHistorySettings","writeProjectPanelsSettings","writeFileBrowserSettings","writeHistory","getChildElementByAttribut","getLangIDFromStr","getLocPathFromStr","feedKeyWordsParameters","feedGUIParameters","feedScintillaParam","feedDockingManager","writeScintillaParams","createXmlTreeFromGUIParams","writeFindHistory","insertDockingParamNode","writePrintSetting","writeExcludedLangList","insertGUIConfigBoolNode","langTypeToCommandID","getWinVersionStr","getWinVerBitStr","writeStyles","insertTabInfo","writeStyle2Element","insertUserLang2Tree","stylerStrOp","addUserModifiedIndex","addPluginModifiedIndex","addScintillaModifiedIndex","safeWow64EnableWow64FsRedirection"],"name":"NppParameters"},{"leaves":["addLexerStyler","eraseAll"],"name":"LexerStylerArray"},{"leaves":["addStyler"],"name":"StyleArray"},{"leaves":["now"],"name":"Date"}],"root":"unitTest1"}
|
{"leaves":["strVal","decStrVal","hexStrVal","getKwClassFromName","getAsciiLenFromBase64Len","base64ToAscii","cutString","RGB2int","convertIntToFormatType"],"nodes":[{"leaves":["getLangFromXmlFileName","getXmlFilePathFromLangName","addLanguageFromXml","switchToLang"],"name":"LocalizationSwitcher"},{"leaves":["getThemeFromXmlFileName"],"name":"ThemeSwitcher"},{"leaves":["getWindowsVersion","reloadStylers","reloadLang","getSpecialFolderLocation","getSettingsFolder","load","destroyInstance","saveConfig_xml","setWorkSpaceFilePath","removeTransparent","SetTransparent","isExistingExternalLangName","getUserDefinedLangNameFromExt","getExternalLangIndexFromName","getULCFromName","getCurLineHilitingColour","setCurLineHilitingColour","setFontList","isInFontList","getLangKeywordsFromXmlTree","getExternalLexerFromXmlTree","addExternalLangToEnd","getUserStylersFromXmlTree","getUserParametersFromXmlTree","getUserDefineLangsFromXmlTree","getShortcutsFromXmlTree","getMacrosFromXmlTree","getUserCmdsFromXmlTree","getPluginCmdsFromXmlTree","getScintKeysFromXmlTree","getBlackListFromXmlTree","initMenuKeys","initScintillaKeys","reloadContextMenuFromXmlTree","getCmdIdFromMenuEntryItemName","getPluginCmdIdFromMenuEntryItemName","getContextMenuFromXmlTree","setWorkingDir","loadSession","getSessionFromXmlTree","feedFileListParameters","feedProjectPanelsParameters","feedFileBrowserParameters","feedFindHistoryParameters","feedShortcut","feedMacros","getActions","feedUserCmds","feedPluginCustomizedCmds","feedScintKeys","feedBlacklist","getShortcuts","feedUserLang","importUDLFromFile","exportUDLToFile","getLangFromExt","setCloudChoice","removeCloudChoice","isCloudPathChanged","writeSettingsFilesOnCloudForThe1stTime","writeUserDefinedLang","insertCmd","insertMacro","insertUserCmd","insertPluginCmd","insertScintKey","writeSession","writeShortcuts","addUserLangToEnd","removeUserLang","feedUserSettings","feedUserKeywordList","feedUserStyles","feedStylerArray","writeRecentFileHistorySettings","writeProjectPanelsSettings","writeFileBrowserSettings","writeHistory","getChildElementByAttribut","getLangIDFromStr","getLocPathFromStr","feedKeyWordsParameters","feedGUIParameters","feedScintillaParam","feedDockingManager","writeScintillaParams","createXmlTreeFromGUIParams","writeFindHistory","insertDockingParamNode","writePrintSetting","writeExcludedLangList","insertGUIConfigBoolNode","langTypeToCommandID","getWinVersionStr","getWinVerBitStr","writeStyles","insertTabInfo","writeStyle2Element","insertUserLang2Tree","stylerStrOp","addUserModifiedIndex","addPluginModifiedIndex","addScintillaModifiedIndex","safeWow64EnableWow64FsRedirection"],"name":"NppParameters"},{"leaves":["addLexerStyler","eraseAll"],"name":"LexerStylerArray"},{"leaves":["addStyler"],"name":"StyleArray"},{"leaves":["now"],"name":"Date"}],"root":"unitTest"}
|
@ -1,26 +1,39 @@
|
|||||||
|
# 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
|
||||||
|
# 1 if unitTest file not found
|
||||||
|
|
||||||
$testRoot = ".\"
|
$testRoot = ".\"
|
||||||
|
|
||||||
$dirName=$args[0]
|
$dirName=$args[0]
|
||||||
$langName=$args[1]
|
$langName=$args[1]
|
||||||
|
|
||||||
|
Try {
|
||||||
if ((Get-Item $testRoot$dirName) -is [System.IO.DirectoryInfo])
|
if ((Get-Item $testRoot$dirName) -is [System.IO.DirectoryInfo])
|
||||||
{
|
|
||||||
..\..\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
|
if (-Not (Test-Path $testRoot$dirName\unitTest))
|
||||||
"$dirName ... OK"
|
{
|
||||||
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
"$dirName ... KO"
|
|
||||||
""
|
|
||||||
"There's a (some) problem(s) in your functionList.xml"
|
|
||||||
exit -1
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Catch
|
||||||
|
{
|
||||||
|
return -1
|
||||||
|
}
|
@ -5,8 +5,50 @@ Foreach-Object {
|
|||||||
if ((Get-Item $testRoot$_) -is [System.IO.DirectoryInfo])
|
if ((Get-Item $testRoot$_) -is [System.IO.DirectoryInfo])
|
||||||
{
|
{
|
||||||
$dirName = (Get-Item $testRoot$_).Name
|
$dirName = (Get-Item $testRoot$_).Name
|
||||||
.\unitTest.ps1 $dirName $dirName
|
$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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
""
|
""
|
||||||
|
Loading…
Reference in New Issue
Block a user