diff options
author | Jason Perkins <starkos@industriousone.com> | 2011-11-09 01:43:49 +0400 |
---|---|---|
committer | Jason Perkins <starkos@industriousone.com> | 2011-11-09 01:43:49 +0400 |
commit | 94a054c1a0a83133189e9c2b6b939a8a8f8abf66 (patch) | |
tree | 34baf1e767703def8bc3c3bff002fc63e1a7cf60 /tests | |
parent | 66b9c9e785e1234a9fc825e73bf7c47d9fca53bd (diff) |
Patch 3381066: Fix VS2010 project references
Diffstat (limited to 'tests')
-rw-r--r-- | tests/actions/vstudio/vc2010/test_links.lua | 87 | ||||
-rw-r--r-- | tests/premake4.lua | 19 |
2 files changed, 97 insertions, 9 deletions
diff --git a/tests/actions/vstudio/vc2010/test_links.lua b/tests/actions/vstudio/vc2010/test_links.lua new file mode 100644 index 0000000..de642f5 --- /dev/null +++ b/tests/actions/vstudio/vc2010/test_links.lua @@ -0,0 +1,87 @@ +-- +-- tests/actions/vstudio/vc2010/test_links.lua +-- Validate linking and project references in Visual Studio 2010 C/C++ projects. +-- Copyright (c) 2011 Jason Perkins and the Premake project +-- + + T.vstudio_vs2010_links = { } + local suite = T.vstudio_vs2010_links + local vc2010 = premake.vstudio.vc2010 + + +-- +-- Setup +-- + + local sln, prj, prj2 + + function suite.setup() + os_uuid = os.uuid + os.uuid = function() return "00112233-4455-6677-8888-99AABBCCDDEE" end + + sln = test.createsolution() + test.createproject(sln) + end + + local function prepare() + premake.bake.buildconfigs() + prj = premake.solution.getproject(sln, 1) + prj2 = premake.solution.getproject(sln, 2) + sln.vstudio_configs = premake.vstudio.buildconfigs(sln) + end + + +-- +-- If there are no sibling projects listed in links(), then the +-- entire project references item group should be skipped. +-- + + function suite.noSectionWritten_onNoSiblingReferences() + prepare() + vc2010.projectReferences(prj2) + test.isemptycapture() + end + + +-- +-- If a sibling project is listed in links(), an item group should +-- be written with a reference to that sibling project. +-- + + function suite.projectReferenceAdded_onSiblingProjectLink() + links { "MyProject" } + prepare() + vc2010.projectReferences(prj2) + test.capture [[ + <ItemGroup> + <ProjectReference Include="MyProject.vcproj"> + <Project>{00112233-4455-6677-8888-99AABBCCDDEE}</Project> + </ProjectReference> + </ItemGroup> + ]] + end + + +-- +-- If a sibling library is listed in links(), it should NOT appear in +-- the additional dependencies element. Visual Studio will figure that +-- out from the project reference item group. +-- + + function suite.noDependencies_onOnlySiblingProjectLinks() + links { "MyProject" } + prepare() + vc2010.additionalDependencies(prj2) + test.isemptycapture() + end + + function suite.onlySystemDependencies_OnSiblingProjectLink() + links { "MyProject", "kernel32" } + prepare() + vc2010.additionalDependencies(prj2) + test.capture [[ + <AdditionalDependencies>kernel32;%(AdditionalDependencies)</AdditionalDependencies> + ]] + end + + diff --git a/tests/premake4.lua b/tests/premake4.lua index 9f5030e..1b5ab45 100644 --- a/tests/premake4.lua +++ b/tests/premake4.lua @@ -13,7 +13,7 @@ test.createsolution = function() local sln = solution "MySolution" configurations { "Debug", "Release" } - + local prj = project "MyProject" language "C++" kind "ConsoleApp" @@ -25,7 +25,7 @@ test.createproject = function(sln) local n = #sln.projects + 1 if n == 1 then n = "" end - + local prj = project ("MyProject" .. n) language "C++" kind "ConsoleApp" @@ -60,14 +60,14 @@ dofile("test_project.lua") dofile("project/test_eachfile.lua") dofile("project/test_vpaths.lua") - + -- Baking tests dofile("base/test_baking.lua") dofile("baking/test_merging.lua") - + -- Clean tests dofile("actions/test_clean.lua") - + -- Visual Studio tests dofile("test_vs2002_sln.lua") dofile("test_vs2003_sln.lua") @@ -100,12 +100,13 @@ dofile("actions/vstudio/vc200x/header.lua") dofile("actions/vstudio/vc200x/files.lua") dofile("actions/vstudio/vc200x/test_filters.lua") - + -- Visual Studio 2010 C/C++ projects dofile("actions/vstudio/vc2010/test_debugdir.lua") dofile("actions/vstudio/vc2010/test_header.lua") dofile("actions/vstudio/vc2010/test_files.lua") dofile("actions/vstudio/vc2010/test_filters.lua") + dofile("actions/vstudio/vc2010/test_links.lua") dofile("actions/vstudio/vc2010/test_pch.lua") -- Makefile tests @@ -123,10 +124,10 @@ -- Xcode4 tests dofile("actions/xcode/test_xcode4_project.lua") dofile("actions/xcode/test_xcode4_workspace.lua") - + -- CodeLite tests dofile("actions/codelite/codelite_files.lua") - + -- CodeBlocks tests dofile("actions/codeblocks/codeblocks_files.lua") dofile("actions/codeblocks/test_filters.lua") @@ -138,7 +139,7 @@ newaction { trigger = "test", description = "Run the automated test suite", - + execute = function () passed, failed = test.runall() msg = string.format("%d tests passed, %d failed", passed, failed) |