diff options
author | Jason Perkins <starkos@industriousone.com> | 2011-07-13 00:55:27 +0400 |
---|---|---|
committer | Jason Perkins <starkos@industriousone.com> | 2011-07-13 00:55:27 +0400 |
commit | a06602621f46f5f9e3f0144a7c73677c6872dbfa (patch) | |
tree | aafb43b283453962b7273239b4134a62f4f274eb /tests | |
parent | 8adaa03be719a893229f285deae1924d95e682ae (diff) |
Removed a bunch of deprecated VC2010 code
Diffstat (limited to 'tests')
-rw-r--r-- | tests/actions/vstudio/test_vs2010_vcxproj.lua | 92 | ||||
-rwxr-xr-x | tests/actions/vstudio/vc2010/test_files.lua | 39 | ||||
-rw-r--r-- | tests/actions/vstudio/vc2010/test_filters.lua | 143 | ||||
-rw-r--r-- | tests/actions/vstudio/vc2010/test_pch.lua | 63 | ||||
-rw-r--r-- | tests/base/test_path.lua | 13 | ||||
-rw-r--r-- | tests/premake4.lua | 1 |
6 files changed, 109 insertions, 242 deletions
diff --git a/tests/actions/vstudio/test_vs2010_vcxproj.lua b/tests/actions/vstudio/test_vs2010_vcxproj.lua index 41b9d1c..c28402f 100644 --- a/tests/actions/vstudio/test_vs2010_vcxproj.lua +++ b/tests/actions/vstudio/test_vs2010_vcxproj.lua @@ -201,36 +201,6 @@ local buffer = get_buffer() test.string_contains(buffer,'<ItemGroup>.*</ItemGroup>') end - - function vs10_vcxproj.fileExtension_extEqualH() - local ext = vc2010.get_file_extension('foo.h') - test.isequal('h', ext) - end - - function vs10_vcxproj.fileExtension_containsTwoDots_extEqualH() - local ext = vc2010.get_file_extension('foo.bar.h') - test.isequal('h', ext) - end - - function vs10_vcxproj.fileExtension_alphaNumeric_extEqualOneH() - local ext = vc2010.get_file_extension('foo.1h') - test.isequal('1h', ext) - end - - function vs10_vcxproj.fileExtension_alphaNumericWithUnderscore_extEqualOne_H() - local ext = vc2010.get_file_extension('foo.1_h') - test.isequal('1_h', ext) - end - - function vs10_vcxproj.fileExtension_containsHyphen_extEqualHHyphenH() - local ext = vc2010.get_file_extension('foo.h-h') - test.isequal('h-h', ext) - end - - function vs10_vcxproj.fileExtension_containsMoreThanOneDot_extEqualOneH() - local ext = vc2010.get_file_extension('foo.bar.h') - test.isequal('h', ext) - end function vs10_vcxproj.itemGroupSection_hasResourceCompileSection() --for some reason this does not work here and it needs to be in @@ -239,11 +209,6 @@ local buffer = get_buffer() test.string_contains(buffer,'<ItemGroup>.*<ResourceCompile.*</ItemGroup>') end - - function vs10_vcxproj.itemGroupSection_hasHeaderListed() - local buffer = get_buffer() - test.string_contains(buffer,'<ItemGroup>.*<ClInclude Include="foo\\dummyHeader%.h" />.*</ItemGroup>') - end function vs10_vcxproj.checkProjectConfigurationOpeningTag_hasACloseingAngleBracket() local buffer = get_buffer() @@ -360,15 +325,6 @@ local buffer = get_buffer() test.string_does_not_contain(buffer,debug_config_pch_string) end - - - function vs10_vcxproj.pchHeaderAndPchSourceSet_bufferContainPchCreate() - configuration("Debug") - pchheader "foo/dummyHeader.h" - pchsource "foo/dummySource.cpp" - local buffer = get_buffer() - test.string_contains(buffer,debug_config_pch_string) - end function vs10_vcxproj.pchHeaderAndSourceSet_yetAlsoNoPch_bufferDoesNotContainpchCreate() configuration('Debug') @@ -379,56 +335,8 @@ test.string_does_not_contain(buffer,debug_config_pch_string) end - function vs10_vcxproj.pchHeaderAndPchSourceSet_debugAndRelease_matchingClCompileBlocks() - configuration("Debug") - pchheader "foo/dummyHeader.h" - pchsource "foo/dummySource.cpp" - configuration("Release") - pchheader "foo/dummyHeader.h" - pchsource "foo/dummySource.cpp" - local buffer = get_buffer() - - local expected = '<ClCompile Include="foo\\dummySource.cpp">%s+' - ..debug_config_pch_string ..'%s+' - ..release_config_pch_string ..'%s+</ClCompile>' - test.string_contains(buffer,expected) - end function vs10_vcxproj.wholeProgramOptimizationIsNotSetByDefault_bufferDoesNotContainWholeProgramOptimization() local buffer = get_buffer() test.string_does_not_contain(buffer,"WholeProgramOptimization") end - - - --- --- Test file sorting into build categories --- - - local function SortAndReturnSortedInputFiles(input) - return vc2010.sort_input_files(input) - end - - function vs10_vcxproj.sortFile_headerFile_SortedClIncludeEqualToFile() - local file = {"bar.h"} - local sorted = SortAndReturnSortedInputFiles(file) - test.isequal(file, sorted.ClInclude) - end - - function vs10_vcxproj.sortFile_srcFile_SortedClCompileEqualToFile() - local file = {"b.cxx"} - local sorted = SortAndReturnSortedInputFiles(file) - test.isequal(file, sorted.ClCompile) - end - - function vs10_vcxproj.sortFile_notRegistered_SortedNoneEqualToFile() - local file = {"foo.bar.00h"} - local sorted = SortAndReturnSortedInputFiles(file) - test.isequal(file, sorted.None) - end - - function vs10_vcxproj.sortFile_resourceScript_resourceCompileEqualToFile() - local file = {"foo.rc"} - local sorted = SortAndReturnSortedInputFiles(file) - test.isequal(file, sorted.ResourceCompile) - end diff --git a/tests/actions/vstudio/vc2010/test_files.lua b/tests/actions/vstudio/vc2010/test_files.lua index 937adab..6cd1a16 100755 --- a/tests/actions/vstudio/vc2010/test_files.lua +++ b/tests/actions/vstudio/vc2010/test_files.lua @@ -28,9 +28,20 @@ -- --- Test grouping and nesting +-- Test file groups -- + function suite.SimpleHeaderFile() + files { "include/hello.h" } + prepare() + test.capture [[ + <ItemGroup> + <ClInclude Include="include\hello.h" /> + </ItemGroup> + ]] + end + + function suite.SimpleSourceFile() files { "hello.c" } prepare() @@ -41,20 +52,34 @@ </ItemGroup> ]] end - - - function suite.SingleFolderLevel() - files { "src/hello.c" } + + + function suite.SimpleNoneFile() + files { "docs/hello.txt" } prepare() test.capture [[ <ItemGroup> - <ClCompile Include="src\hello.c"> - </ClCompile> + <None Include="docs\hello.txt" /> + </ItemGroup> + ]] + end + + + function suite.SimpleResourceFile() + files { "resources/hello.rc" } + prepare() + test.capture [[ + <ItemGroup> + <ResourceCompile Include="resources\hello.rc" /> </ItemGroup> ]] end +-- +-- Test path handling +-- + function suite.MultipleFolderLevels() files { "src/greetings/hello.c" } prepare() diff --git a/tests/actions/vstudio/vc2010/test_filters.lua b/tests/actions/vstudio/vc2010/test_filters.lua index b53955c..f603015 100644 --- a/tests/actions/vstudio/vc2010/test_filters.lua +++ b/tests/actions/vstudio/vc2010/test_filters.lua @@ -28,140 +28,12 @@ os.uuid = os_uuid
end
- local function get_buffer()
- premake.bake.buildconfigs()
- sln.vstudio_configs = premake.vstudio.buildconfigs(sln)
- vc2010.generate_filters(prj)
- buffer = io.endcapture()
- return buffer
- end
-
local function prepare()
premake.bake.buildconfigs()
sln.vstudio_configs = premake.vstudio.buildconfigs(sln)
end
---
--- Tests
---
-
- function suite.path_noPath_returnsNil()
- local result = vc2010.file_path("foo.h")
- test.isequal(nil,result)
- end
-
- function suite.path_hasOneDirectoryPath_returnsIsFoo()
- local path = "foo"
- local result = vc2010.file_path(path .."\\foo.h")
- test.isequal(path,result)
- end
-
- function suite.path_hasTwoDirectoryPath_returnsIsFooSlashBar()
- local path = "foo\\bar"
- local result = vc2010.file_path(path .."\\foo.h")
- test.isequal(path,result)
- end
-
- function suite.path_hasTwoDirectoryPath_returnsIsFooSlashBar_Baz()
- local path = "foo\\bar_baz"
- local result = vc2010.file_path(path .."\\foo.h")
- test.isequal(path,result)
- end
-
- function suite.path_extensionWithHyphen_returnsIsFoo()
- local path = "foo"
- local result = vc2010.file_path(path .."\\foo-bar.h")
- test.isequal(path,result)
- end
-
- function suite.path_extensionWithNumber_returnsIs2Foo()
- local path = "foo"
- local result = vc2010.file_path(path .."\\2foo.h")
- test.isequal(path,result)
- end
-
- function suite.path_hasThreeDirectoryPath_returnsIsFooSlashBarSlashBaz()
- local path = "foo\\bar\\baz"
- local result = vc2010.file_path(path .."\\foo.h")
- test.isequal(path,result)
- end
-
- function suite.path_hasDotDotSlashDirectoryPath_returnsNil()
- local path = ".."
- local result = vc2010.file_path(path .."\\foo.h")
- test.isequal(nil,result)
- end
-
- function suite.removeRelativePath_noRelativePath_returnsInput()
- local path = "foo.h"
- local result = vc2010.remove_relative_path(path)
- test.isequal("foo.h",result)
- end
-
- function suite.removeRelativePath_dotDotSlashFoo_returnsFoo()
- local path = "..\\foo"
- local result = vc2010.remove_relative_path(path)
- test.isequal("foo",result)
- end
-
- function suite.removeRelativePath_dotDotSlashDotDotSlashFoo_returnsFoo()
- local path = "..\\..\\foo"
- local result = vc2010.remove_relative_path(path)
- test.isequal("foo",result)
- end
-
- function suite.removeRelativePath_DotSlashFoo_returnsFoo()
- local path = ".\\foo"
- local result = vc2010.remove_relative_path(path)
- test.isequal("foo",result)
- end
-
- function suite.clIncludeFilter_oneInputFile_bufferContainsTagClInclude()
- files
- {
- "dontCare.h"
- }
- local buffer = get_buffer()
- test.string_contains(buffer,'<ClInclude')
- end
-
- function suite.clIncludeFilter_oneInputFileWithoutDirectory_bufferContainsTagClIncludeOnOneLine()
- files
- {
- "foo.h"
- }
- local buffer = get_buffer()
- test.string_contains(buffer,'<ClInclude Include="foo.h" />')
- end
-
- function suite.clCompileFilter_oneInputFile_bufferContainsTagClCompile()
- files
- {
- "dontCare.cpp"
- }
- local buffer = get_buffer()
- test.string_contains(buffer,'<ClCompile')
- end
-
- function suite.noneFilter_oneInputFile_bufferContainsTagNone()
- files
- {
- "dontCare.ext"
- }
- local buffer = get_buffer()
- test.string_contains(buffer,'<None')
- end
-
- function suite.resourceCompileFilter_oneInputFile_bufferContainsTagResourceCompile()
- files
- {
- "dontCare.rc"
- }
- local buffer = get_buffer()
- test.string_contains(buffer,'<ResourceCompile')
- end
-
--
-- Filter identifiers sections
@@ -319,18 +191,3 @@ </ItemGroup>
]]
end
-
-
- -- one file needs a filter, another doesn't
-
- -- assigns to real paths
-
- -- assigns to vpaths
-
- -- writes none filter
-
- -- writes include filter
-
- -- writes resource filter
- -- anything else?
-
\ No newline at end of file diff --git a/tests/actions/vstudio/vc2010/test_pch.lua b/tests/actions/vstudio/vc2010/test_pch.lua new file mode 100644 index 0000000..fad5025 --- /dev/null +++ b/tests/actions/vstudio/vc2010/test_pch.lua @@ -0,0 +1,63 @@ +-- +-- tests/actions/vstudio/vc2010/test_pch.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_pch = { } + local suite = T.vstudio_vs2010_pch + local vc2010 = premake.vstudio.vc2010 + + +-- +-- Setup +-- + + local sln, prj + + function suite.setup() + sln = test.createsolution() + end + + local function prepare() + premake.bake.buildconfigs() + prj = premake.solution.getproject(sln, 1) + sln.vstudio_configs = premake.vstudio.buildconfigs(sln) + vc2010.files(prj) + end + + +-- +-- Tests +-- + + function suite.pch_OnProject() + files { "afxwin.cpp" } + pchheader "afxwin.h" + pchsource "afxwin.cpp" + prepare() + test.capture [[ + <ItemGroup> + <ClCompile Include="afxwin.cpp"> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader> + </ClCompile> + </ItemGroup> + ]] + end + + + function suite.pch_OnSingleConfig() + files { "afxwin.cpp" } + configuration "Debug" + pchheader "afxwin.h" + pchsource "afxwin.cpp" + prepare() + test.capture [[ + <ItemGroup> + <ClCompile Include="afxwin.cpp"> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> + </ClCompile> + </ItemGroup> + ]] + end diff --git a/tests/base/test_path.lua b/tests/base/test_path.lua index 19b212c..c2b153f 100644 --- a/tests/base/test_path.lua +++ b/tests/base/test_path.lua @@ -104,6 +104,19 @@ function suite.getextension_OnMultipleDots() test.isequal(".txt", path.getextension("filename.mod.txt")) end + + function suite.getextension_OnLeadingNumeric() + test.isequal(".7z", path.getextension("filename.7z")) + end + + function suite.getextension_OnUnderscore() + test.isequal(".a_c", path.getextension("filename.a_c")) + end + + function suite.getextension_OnHyphen() + test.isequal(".a-c", path.getextension("filename.a-c")) + end + -- diff --git a/tests/premake4.lua b/tests/premake4.lua index 25fb029..8f4620c 100644 --- a/tests/premake4.lua +++ b/tests/premake4.lua @@ -105,6 +105,7 @@ 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_pch.lua") -- Makefile tests dofile("actions/make/test_make_escaping.lua") |