Fixed issues with duplicate tests
- Test suite will now fail when test names are reused - Fixed several unit tests that reused test names
This commit is contained in:
parent
a2cd65bb50
commit
138a443b3c
@ -196,7 +196,7 @@ cmd2</StartupCommands>
|
|||||||
]]
|
]]
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.OnProject_PreBuild()
|
function suite.OnProject_PostBuild()
|
||||||
postbuildcommands { "cmd0", "cmd1" }
|
postbuildcommands { "cmd0", "cmd1" }
|
||||||
prepare()
|
prepare()
|
||||||
codelite.project.postBuild(prj)
|
codelite.project.postBuild(prj)
|
||||||
|
@ -143,7 +143,7 @@
|
|||||||
|
|
||||||
prepare { "ldFlags", "libs", "ldDeps" }
|
prepare { "ldFlags", "libs", "ldDeps" }
|
||||||
test.capture [[
|
test.capture [[
|
||||||
ALL_LDFLAGS += $(LDFLAGS) -s
|
ALL_LDFLAGS += $(LDFLAGS) -Wl,-rpath,'$$ORIGIN/../../build/bin/Debug' -s
|
||||||
LIBS += build/bin/Debug/libMyProject2.so
|
LIBS += build/bin/Debug/libMyProject2.so
|
||||||
LDDEPS += build/bin/Debug/libMyProject2.so
|
LDDEPS += build/bin/Debug/libMyProject2.so
|
||||||
]]
|
]]
|
||||||
@ -153,7 +153,7 @@
|
|||||||
-- Check a linking to a sibling shared library using -l and -L.
|
-- Check a linking to a sibling shared library using -l and -L.
|
||||||
--
|
--
|
||||||
|
|
||||||
function suite.links_onSiblingSharedLib()
|
function suite.links_onSiblingSharedLibRelativeLinks()
|
||||||
links "MyProject2"
|
links "MyProject2"
|
||||||
flags { "RelativeLinks" }
|
flags { "RelativeLinks" }
|
||||||
|
|
||||||
@ -260,7 +260,7 @@
|
|||||||
-- is stripped
|
-- is stripped
|
||||||
--
|
--
|
||||||
|
|
||||||
function suite.onExternalLibraryWithPath()
|
function suite.onExternalLibraryWithPathAndVersion()
|
||||||
location "MyProject"
|
location "MyProject"
|
||||||
links { "libs/SomeLib-1.1" }
|
links { "libs/SomeLib-1.1" }
|
||||||
prepare { "libs", }
|
prepare { "libs", }
|
||||||
|
@ -30,6 +30,6 @@
|
|||||||
-- Remove parenthesis.
|
-- Remove parenthesis.
|
||||||
--
|
--
|
||||||
|
|
||||||
function suite.removesDashes()
|
function suite.removesParenthesis()
|
||||||
test.isequal("MyProject_x86", make.tovar("MyProject (x86)"))
|
test.isequal("MyProject_x86", make.tovar("MyProject (x86)"))
|
||||||
end
|
end
|
||||||
|
@ -46,7 +46,7 @@ endif
|
|||||||
-- If a map is present, the configuration change should be applied.
|
-- If a map is present, the configuration change should be applied.
|
||||||
--
|
--
|
||||||
|
|
||||||
function suite.passesThroughConfigs_onNoMap()
|
function suite.passesThroughConfigs_onMap()
|
||||||
configmap { Debug = "Development" }
|
configmap { Debug = "Development" }
|
||||||
prepare()
|
prepare()
|
||||||
test.capture [[
|
test.capture [[
|
||||||
@ -65,7 +65,7 @@ endif
|
|||||||
-- no mapping should be created.
|
-- no mapping should be created.
|
||||||
--
|
--
|
||||||
|
|
||||||
function suite.passesThroughConfigs_onNoMap()
|
function suite.passesThroughConfigs_onNoMapRemovedConfiguration()
|
||||||
removeconfigurations { "Debug" }
|
removeconfigurations { "Debug" }
|
||||||
prepare()
|
prepare()
|
||||||
test.capture [[
|
test.capture [[
|
||||||
|
@ -145,7 +145,7 @@ LDDEPS += build/bin/Debug/libMyProject2.a
|
|||||||
|
|
||||||
prepare { "ldFlags", "libs", "ldDeps" }
|
prepare { "ldFlags", "libs", "ldDeps" }
|
||||||
test.capture [[
|
test.capture [[
|
||||||
ALL_LDFLAGS += $(LDFLAGS) -s
|
ALL_LDFLAGS += $(LDFLAGS) -Wl,-rpath,'$$ORIGIN/../../build/bin/Debug' -s
|
||||||
LIBS += build/bin/Debug/libMyProject2.so
|
LIBS += build/bin/Debug/libMyProject2.so
|
||||||
LDDEPS += build/bin/Debug/libMyProject2.so
|
LDDEPS += build/bin/Debug/libMyProject2.so
|
||||||
]]
|
]]
|
||||||
@ -155,7 +155,7 @@ LDDEPS += build/bin/Debug/libMyProject2.so
|
|||||||
-- Check a linking to a sibling shared library using -l and -L.
|
-- Check a linking to a sibling shared library using -l and -L.
|
||||||
--
|
--
|
||||||
|
|
||||||
function suite.links_onSiblingSharedLib()
|
function suite.links_onSiblingSharedLibRelativeLinks()
|
||||||
links "MyProject2"
|
links "MyProject2"
|
||||||
flags { "RelativeLinks" }
|
flags { "RelativeLinks" }
|
||||||
|
|
||||||
@ -262,7 +262,7 @@ LIBS += -lSomeLib
|
|||||||
-- is stripped
|
-- is stripped
|
||||||
--
|
--
|
||||||
|
|
||||||
function suite.onExternalLibraryWithPath()
|
function suite.onExternalLibraryWithPathAndVersion()
|
||||||
location "MyProject"
|
location "MyProject"
|
||||||
links { "libs/SomeLib-1.1" }
|
links { "libs/SomeLib-1.1" }
|
||||||
prepare { "libs", }
|
prepare { "libs", }
|
||||||
|
@ -37,7 +37,9 @@
|
|||||||
|
|
||||||
|
|
||||||
function m.executeSelfTest()
|
function m.executeSelfTest()
|
||||||
|
m.detectDuplicateTests = true
|
||||||
m.loadTestsFromManifests()
|
m.loadTestsFromManifests()
|
||||||
|
m.detectDuplicateTests = false
|
||||||
|
|
||||||
local test, err = m.getTestWithIdentifier(_OPTIONS["test-only"])
|
local test, err = m.getTestWithIdentifier(_OPTIONS["test-only"])
|
||||||
if err then
|
if err then
|
||||||
|
@ -36,7 +36,14 @@
|
|||||||
error('Duplicate test suite "'.. suiteName .. '"', 2)
|
error('Duplicate test suite "'.. suiteName .. '"', 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
local suite = {}
|
local _suite = {}
|
||||||
|
-- Setup a metatable for the test suites to use, this will catch duplicate tests
|
||||||
|
local suite = setmetatable({}, {
|
||||||
|
__index = _suite,
|
||||||
|
__newindex = function (table, key, value) if m.detectDuplicateTests and _suite[key] ~= nil then error('Duplicate test "'.. key .. '"', 2) end _suite[key] = value end,
|
||||||
|
__pairs = function (table) return pairs(_suite) end,
|
||||||
|
__ipairs = function (table) return ipairs(_suite) end,
|
||||||
|
})
|
||||||
|
|
||||||
suite._SCRIPT_DIR = _SCRIPT_DIR
|
suite._SCRIPT_DIR = _SCRIPT_DIR
|
||||||
suite._TESTS_DIR = _TESTS_DIR
|
suite._TESTS_DIR = _TESTS_DIR
|
||||||
|
@ -126,7 +126,7 @@ Environment="key=value
foo=bar"
|
|||||||
-- flag is set.
|
-- flag is set.
|
||||||
--
|
--
|
||||||
|
|
||||||
function suite.environmentVarsSet_onDebugEnvs()
|
function suite.environmentVarsSet_onDebugEnvsAndDebugEnvsDontMerge()
|
||||||
debugenvs { "key=value" }
|
debugenvs { "key=value" }
|
||||||
flags { "DebugEnvsDontMerge" }
|
flags { "DebugEnvsDontMerge" }
|
||||||
prepare()
|
prepare()
|
||||||
|
@ -260,7 +260,7 @@
|
|||||||
-- If defines are specified with escapable characters, they should be escaped.
|
-- If defines are specified with escapable characters, they should be escaped.
|
||||||
--
|
--
|
||||||
|
|
||||||
function suite.preprocessorDefinitions_onDefines()
|
function suite.preprocessorDefinitions_onDefinesWithEscapeCharacters()
|
||||||
p.escaper(p.vstudio.vs2010.esc)
|
p.escaper(p.vstudio.vs2010.esc)
|
||||||
defines { "&", "<", ">" }
|
defines { "&", "<", ">" }
|
||||||
prepare()
|
prepare()
|
||||||
@ -477,8 +477,32 @@
|
|||||||
]]
|
]]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Check handling of the explicitly disabling symbols.
|
||||||
|
-- Note: VS2013 and older have a bug with setting
|
||||||
|
-- DebugInformationFormat to None. The workaround
|
||||||
|
-- is to leave the field blank.
|
||||||
|
--
|
||||||
function suite.onNoSymbols()
|
function suite.onNoSymbols()
|
||||||
symbols "Off"
|
symbols 'Off'
|
||||||
|
prepare()
|
||||||
|
test.capture [[
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<DebugInformationFormat></DebugInformationFormat>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
]]
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- VS2015 and newer can use DebugInformationFormat None.
|
||||||
|
--
|
||||||
|
function suite.onNoSymbolsVS2015()
|
||||||
|
symbols 'Off'
|
||||||
|
p.action.set("vs2015")
|
||||||
prepare()
|
prepare()
|
||||||
test.capture [[
|
test.capture [[
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
@ -486,7 +510,6 @@
|
|||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<DebugInformationFormat>None</DebugInformationFormat>
|
<DebugInformationFormat>None</DebugInformationFormat>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
</ClCompile>
|
|
||||||
]]
|
]]
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -837,42 +860,6 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Check handling of the explicitly disabling symbols.
|
|
||||||
-- Note: VS2013 and older have a bug with setting
|
|
||||||
-- DebugInformationFormat to None. The workaround
|
|
||||||
-- is to leave the field blank.
|
|
||||||
--
|
|
||||||
function suite.onNoSymbols()
|
|
||||||
symbols 'Off'
|
|
||||||
prepare()
|
|
||||||
test.capture [[
|
|
||||||
<ClCompile>
|
|
||||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
|
||||||
<WarningLevel>Level3</WarningLevel>
|
|
||||||
<DebugInformationFormat></DebugInformationFormat>
|
|
||||||
<Optimization>Disabled</Optimization>
|
|
||||||
]]
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- VS2015 and newer can use DebugInformationFormat None.
|
|
||||||
--
|
|
||||||
function suite.onNoSymbolsVS2015()
|
|
||||||
symbols 'Off'
|
|
||||||
p.action.set("vs2015")
|
|
||||||
prepare()
|
|
||||||
test.capture [[
|
|
||||||
<ClCompile>
|
|
||||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
|
||||||
<WarningLevel>Level3</WarningLevel>
|
|
||||||
<DebugInformationFormat>None</DebugInformationFormat>
|
|
||||||
<Optimization>Disabled</Optimization>
|
|
||||||
]]
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Check handling of the stringpooling api
|
-- Check handling of the stringpooling api
|
||||||
--
|
--
|
||||||
|
@ -92,7 +92,7 @@
|
|||||||
-- Multiple environment variables should be separated by a "\n" sequence.
|
-- Multiple environment variables should be separated by a "\n" sequence.
|
||||||
--
|
--
|
||||||
|
|
||||||
function suite.localDebuggerEnv_onDebugEnv()
|
function suite.localDebuggerEnv_onMultipleDebugEnv()
|
||||||
debugenvs { "key=value", "foo=bar" }
|
debugenvs { "key=value", "foo=bar" }
|
||||||
prepare()
|
prepare()
|
||||||
test.capture [[
|
test.capture [[
|
||||||
|
@ -190,7 +190,7 @@
|
|||||||
--
|
--
|
||||||
-- Check handling of .asm files
|
-- Check handling of .asm files
|
||||||
--
|
--
|
||||||
function suite.itemGroup_onNoneSection()
|
function suite.itemGroup_onMasmSection()
|
||||||
files { "hello.asm" }
|
files { "hello.asm" }
|
||||||
prepare()
|
prepare()
|
||||||
test.capture [[
|
test.capture [[
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
--
|
--
|
||||||
-- Ensure configuration file is output in ImageXex block
|
-- Ensure configuration file is output in ImageXex block
|
||||||
--
|
--
|
||||||
function suite.defaultSettings()
|
function suite.onConfigfile()
|
||||||
configfile "testconfig.xml"
|
configfile "testconfig.xml"
|
||||||
prepare()
|
prepare()
|
||||||
test.capture [[
|
test.capture [[
|
||||||
|
@ -716,7 +716,7 @@
|
|||||||
-- Test ignoring default libraries without extensions specified.
|
-- Test ignoring default libraries without extensions specified.
|
||||||
--
|
--
|
||||||
|
|
||||||
function suite.ignoreDefaultLibraries_WithExtensions()
|
function suite.ignoreDefaultLibraries_WithoutExtensions()
|
||||||
ignoredefaultlibraries { "lib1", "lib2.obj" }
|
ignoredefaultlibraries { "lib1", "lib2.obj" }
|
||||||
prepare()
|
prepare()
|
||||||
test.capture [[
|
test.capture [[
|
||||||
|
@ -80,7 +80,7 @@
|
|||||||
-- Managed C++ projects write out references a little differently.
|
-- Managed C++ projects write out references a little differently.
|
||||||
--
|
--
|
||||||
|
|
||||||
function suite.referencesAreRelative_onDifferentProjectLocation()
|
function suite.referencesAreRelative_onDifferentProjectLocationWithCLR()
|
||||||
links { "MyProject" }
|
links { "MyProject" }
|
||||||
clr "On"
|
clr "On"
|
||||||
prepare()
|
prepare()
|
||||||
|
@ -116,7 +116,7 @@
|
|||||||
test.istrue(path.hasdeferredjoin("p1|%{foo}"))
|
test.istrue(path.hasdeferredjoin("p1|%{foo}"))
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.deferred_join_OnValidParts()
|
function suite.has_deferred_join_false()
|
||||||
test.isfalse(path.hasdeferredjoin("p1/p2"))
|
test.isfalse(path.hasdeferredjoin("p1/p2"))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@
|
|||||||
-- Shared library should use implibname() if present.
|
-- Shared library should use implibname() if present.
|
||||||
--
|
--
|
||||||
|
|
||||||
function suite.basenameIsTargetName_onTargetName()
|
function suite.basenameIsImplibName_onTargetName()
|
||||||
kind "SharedLib"
|
kind "SharedLib"
|
||||||
targetname "MyTarget"
|
targetname "MyTarget"
|
||||||
implibname "MyTargetImports"
|
implibname "MyTargetImports"
|
||||||
|
@ -188,7 +188,7 @@
|
|||||||
-- Name should use ".exe" for Xbox360 executables.
|
-- Name should use ".exe" for Xbox360 executables.
|
||||||
--
|
--
|
||||||
|
|
||||||
function suite.nameUsesExe_onWindowsConsoleApp()
|
function suite.nameUsesExe_onXbox360ConsoleApp()
|
||||||
kind "ConsoleApp"
|
kind "ConsoleApp"
|
||||||
system "Xbox360"
|
system "Xbox360"
|
||||||
i = prepare()
|
i = prepare()
|
||||||
@ -265,7 +265,7 @@
|
|||||||
-- .NET libraries should always default to ".dll" extensions.
|
-- .NET libraries should always default to ".dll" extensions.
|
||||||
--
|
--
|
||||||
|
|
||||||
function suite.appUsesExe_onDotNet()
|
function suite.appUsesExe_onDotNetSharedLib()
|
||||||
_TARGET_OS = "macosx"
|
_TARGET_OS = "macosx"
|
||||||
language "C#"
|
language "C#"
|
||||||
kind "SharedLib"
|
kind "SharedLib"
|
||||||
|
@ -100,12 +100,6 @@
|
|||||||
test.isequal("Headers/hello.h", run())
|
test.isequal("Headers/hello.h", run())
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.MatchFilePattern_ToNestedGroup_Flat()
|
|
||||||
files { "src/myproject/hello.h" }
|
|
||||||
vpaths { ["Group/Headers"] = "**.h" }
|
|
||||||
test.isequal("Group/Headers/hello.h", run())
|
|
||||||
end
|
|
||||||
|
|
||||||
function suite.MatchFilePattern_ToGroup_Nested()
|
function suite.MatchFilePattern_ToGroup_Nested()
|
||||||
files { "src/myproject/hello.h" }
|
files { "src/myproject/hello.h" }
|
||||||
vpaths { ["Headers/*"] = "**.h" }
|
vpaths { ["Headers/*"] = "**.h" }
|
||||||
|
Loading…
Reference in New Issue
Block a user