From a06602621f46f5f9e3f0144a7c73677c6872dbfa Mon Sep 17 00:00:00 2001 From: Jason Perkins Date: Tue, 12 Jul 2011 16:55:27 -0400 Subject: Removed a bunch of deprecated VC2010 code --- tests/actions/vstudio/test_vs2010_vcxproj.lua | 92 ----------------- tests/actions/vstudio/vc2010/test_files.lua | 39 +++++-- tests/actions/vstudio/vc2010/test_filters.lua | 143 -------------------------- tests/actions/vstudio/vc2010/test_pch.lua | 63 ++++++++++++ tests/base/test_path.lua | 13 +++ tests/premake4.lua | 1 + 6 files changed, 109 insertions(+), 242 deletions(-) create mode 100644 tests/actions/vstudio/vc2010/test_pch.lua (limited to 'tests') 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,'.*') 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,'.*') end - - function vs10_vcxproj.itemGroupSection_hasHeaderListed() - local buffer = get_buffer() - test.string_contains(buffer,'.*.*') - 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 = '%s+' - ..debug_config_pch_string ..'%s+' - ..release_config_pch_string ..'%s+' - 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 [[ + + + + ]] + end + + function suite.SimpleSourceFile() files { "hello.c" } prepare() @@ -41,20 +52,34 @@ ]] end - - - function suite.SingleFolderLevel() - files { "src/hello.c" } + + + function suite.SimpleNoneFile() + files { "docs/hello.txt" } prepare() test.capture [[ - - + + + ]] + end + + + function suite.SimpleResourceFile() + files { "resources/hello.rc" } + prepare() + test.capture [[ + + ]] 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,'') - end - - function suite.clCompileFilter_oneInputFile_bufferContainsTagClCompile() - files - { - "dontCare.cpp" - } - local buffer = get_buffer() - test.string_contains(buffer,' ]] 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 [[ + + + Create + Create + + + ]] + end + + + function suite.pch_OnSingleConfig() + files { "afxwin.cpp" } + configuration "Debug" + pchheader "afxwin.h" + pchsource "afxwin.cpp" + prepare() + test.capture [[ + + + Create + + + ]] + 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") -- cgit v1.2.3