diff options
author | Jason Perkins <starkos@industriousone.com> | 2011-05-10 21:56:25 +0400 |
---|---|---|
committer | Jason Perkins <starkos@industriousone.com> | 2011-05-10 21:56:25 +0400 |
commit | ddd032645e450eb1bcd39c3aac3080082b2171f2 (patch) | |
tree | ecfdaf35e1458ae0483b24704d2c4d97345b67f4 /tests | |
parent | 603575e648704101f6c566af55fb3dd2472c7396 (diff) |
Tweaks and tests for VS2010 file handling
Diffstat (limited to 'tests')
-rw-r--r-- | tests/actions/vstudio/test_vs2010_vcxproj.lua | 11 | ||||
-rwxr-xr-x | tests/actions/vstudio/vc2010/files.lua | 67 | ||||
-rw-r--r-- | tests/premake4.lua | 1 |
3 files changed, 70 insertions, 9 deletions
diff --git a/tests/actions/vstudio/test_vs2010_vcxproj.lua b/tests/actions/vstudio/test_vs2010_vcxproj.lua index 4f192f1..de48f3b 100644 --- a/tests/actions/vstudio/test_vs2010_vcxproj.lua +++ b/tests/actions/vstudio/test_vs2010_vcxproj.lua @@ -227,16 +227,9 @@ end local function SortAndReturnSortedInputFiles(input) - local sorted = - { - ClInclude ={}, - ClCompile ={}, - None ={}, - ResourceCompile ={} - } - vc2010.sort_input_files(input,sorted) - return sorted + return vc2010.sort_input_files(input) end + function vs10_vcxproj.sortFile_headerFile_SortedClIncludeEqualToFile() local file = {"bar.h"} local sorted = SortAndReturnSortedInputFiles(file) diff --git a/tests/actions/vstudio/vc2010/files.lua b/tests/actions/vstudio/vc2010/files.lua new file mode 100755 index 0000000..685f338 --- /dev/null +++ b/tests/actions/vstudio/vc2010/files.lua @@ -0,0 +1,67 @@ +-- +-- tests/actions/vstudio/vc2010/files.lua +-- Validate generation of files block in Visual Studio 2010 C/C++ projects. +-- Copyright (c) 2011 Jason Perkins and the Premake project +-- + + T.vstudio_vs2010_files = { } + local suite = T.vstudio_vs2010_files + local vc2010 = premake.vstudio.vc2010 + + +-- +-- Setup +-- + + local sln, prj + + function suite.setup() + sln = test.createsolution() + end + + local function prepare() + premake.buildconfigs() + prj = premake.solution.getproject(sln, 1) + sln.vstudio_configs = premake.vstudio.buildconfigs(sln) + vc2010.files(prj) + end + + +-- +-- Test grouping and nesting +-- + + function suite.SimpleSourceFile() + files { "hello.c" } + prepare() + test.capture [[ + <ItemGroup> + <ClCompile Include="hello.c"> + </ClCompile> + </ItemGroup> + ]] + end + + + function suite.SingleFolderLevel() + files { "src/hello.c" } + prepare() + test.capture [[ + <ItemGroup> + <ClCompile Include="src\hello.c"> + </ClCompile> + </ItemGroup> + ]] + end + + + function suite.MultipleFolderLevels() + files { "src/greetings/hello.c" } + prepare() + test.capture [[ + <ItemGroup> + <ClCompile Include="src\greetings\hello.c"> + </ClCompile> + </ItemGroup> + ]] + end diff --git a/tests/premake4.lua b/tests/premake4.lua index cf332c1..ae9c249 100644 --- a/tests/premake4.lua +++ b/tests/premake4.lua @@ -96,6 +96,7 @@ -- Visual Studio 2010 C/C++ projects dofile("actions/vstudio/vc2010/debugdir.lua") + dofile("actions/vstudio/vc2010/files.lua") -- Makefile tests dofile("actions/make/test_make_escaping.lua") |