File: test_vs2010_project_kinds.lua

package info (click to toggle)
premake4 4.3%2Brepack1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,852 kB
  • sloc: ansic: 636; makefile: 57; sh: 2
file content (206 lines) | stat: -rw-r--r-- 7,843 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
	T.vs2010_project_kinds= { }
	local vs10_project_kinds = T.vs2010_project_kinds
	local sln, prj

	function vs10_project_kinds.setup()
		_ACTION = "vs2010"

		sln = solution "MySolution"
		configurations { "Debug" }
		platforms {}
	
		prj = project "MyProject"
		language "C++"
	end
	
	local function get_buffer()
		io.capture()
		premake.buildconfigs()
		sln.vstudio_configs = premake.vstudio_buildconfigs(sln)
		premake.vs2010_vcxproj(prj)
		buffer = io.endcapture()
		return buffer
	end
	--incorrect assumption
	--[[
	function vs10_project_kinds.staticLib_doesNotContainLinkSection()
		kind "StaticLib"
		local buffer = get_buffer()
		test.string_does_not_contain(buffer,'<Link>.*</Link>')
	end
	--]]
		
	function vs10_project_kinds.staticLib_containsLibSection()
		kind "StaticLib"
		local buffer = get_buffer()
		test.string_contains(buffer,'<ItemDefinitionGroup.*<Lib>.*</Lib>.*</ItemDefinitionGroup>')
	end
	function vs10_project_kinds.staticLib_libSection_containsProjectNameDotLib()
		kind "StaticLib"
		local buffer = get_buffer()
		test.string_contains(buffer,'<Lib>.*<OutputFile>.*MyProject.lib.*</OutputFile>.*</Lib>')
	end
	--[[
	function vs10_project_kinds.sharedLib_fail_asIDoNotKnowWhatItShouldLookLike_printsTheBufferSoICanCompare()
		kind "SharedLib"
		local buffer = get_buffer()
		test.string_contains(buffer,'youWillNotFindThis')
	end
	--]]
		
	--[[
check OutDir in debug it is showing "."
shared lib missing  <ImportLibrary>???</ImportLibrary> in link section when noInportLib not used
	--]]
	--check why  <MinimalRebuild>true</MinimalRebuild> is missing in a debug static lib and shared lib build
	function vs10_project_kinds.staticLib_valueInMinimalRebuildIsTrue()
		kind "StaticLib"
		flags  {"Symbols"}
		local buffer = get_buffer()
		test.string_contains(buffer,'<ClCompile>.*<MinimalRebuild>true</MinimalRebuild>.*</ClCompile>')
	end
	function vs10_project_kinds.sharedLib_valueInMinimalRebuildIsTrue()
		kind "SharedLib"
		flags  {"Symbols"}
		local buffer = get_buffer()
		test.string_contains(buffer,'<ClCompile>.*<MinimalRebuild>true</MinimalRebuild>.*</ClCompile>')
	end
	--shared lib missing <DebugInformationFormat>EditAndContinue</DebugInformationFormat> in ClCompile section
	function vs10_project_kinds.sharedLib_valueDebugInformationFormatIsEditAndContinue()
		kind "SharedLib"
		flags  {"Symbols"}
		local buffer = get_buffer()
		test.string_contains(buffer,'<ClCompile>.*<DebugInformationFormat>EditAndContinue</DebugInformationFormat>.*</ClCompile>')
	end
	function vs10_project_kinds.sharedLib_valueGenerateDebugInformationIsTrue()
		kind "SharedLib"
		flags  {"Symbols"}
		local buffer = get_buffer()
		test.string_contains(buffer,'<Link>.*<GenerateDebugInformation>true</GenerateDebugInformation>.*</Link>')
	end
	function vs10_project_kinds.sharedLib_linkSectionContainsImportLibrary()
		kind "SharedLib"
		local buffer = get_buffer()
		test.string_contains(buffer,'<Link>.*<ImportLibrary>.*</ImportLibrary>.*</Link>')
	end
	
	function vs10_project_kinds.sharedLib_bufferContainsImportLibrary()
		kind "SharedLib"
		local buffer = get_buffer()
		test.string_contains(buffer,'<Link>.*<ImportLibrary>MyProject.lib</ImportLibrary>.*</Link>')
	end
	--should this go in vs2010_flags???

	function vs10_project_kinds.sharedLib_withNoImportLibraryFlag_linkSectionContainsImportLibrary()
		kind "SharedLib"
		flags{"NoImportLib"}
		local buffer = get_buffer()
		test.string_contains(buffer,'<Link>.*<ImportLibrary>.*</ImportLibrary>.*</Link>')
	end

	function vs10_project_kinds.sharedLib_withOutNoImportLibraryFlag_propertyGroupSectionContainsIgnoreImportLibrary()
		kind "SharedLib"
		local buffer = get_buffer()
		test.string_contains(buffer,'<PropertyGroup>.*<IgnoreImportLibrary.*</IgnoreImportLibrary>.*</PropertyGroup>')
	end
	
	function vs10_project_kinds.sharedLib_withNoImportLibraryFlag_propertyGroupSectionContainsIgnoreImportLibrary()
		kind "SharedLib"
		flags{"NoImportLib"}
		local buffer = get_buffer()
		test.string_contains(buffer,'<PropertyGroup>.*<IgnoreImportLibrary.*</IgnoreImportLibrary>.*</PropertyGroup>')
	end
	
	function vs10_project_kinds.sharedLib_withOutNoImportLibraryFlag_ignoreImportLibraryValueIsFalse()
		kind "SharedLib"
		local buffer = get_buffer()
		test.string_contains(buffer,'<PropertyGroup>.*<IgnoreImportLibrary.*false</IgnoreImportLibrary>.*</PropertyGroup>')
	end
	
	function vs10_project_kinds.sharedLib_withNoImportLibraryFlag_ignoreImportLibraryValueIsTrue()
		kind "SharedLib"
		flags{"NoImportLib"}
		local buffer = get_buffer()
		test.string_contains(buffer,'<PropertyGroup>.*<IgnoreImportLibrary.*true</IgnoreImportLibrary>.*</PropertyGroup>')
	end
	
	--shared lib LinkIncremental set to incorrect value of false
	function vs10_project_kinds.staticLib_doesNotContainLinkIncremental()
		kind "StaticLib"
		flags  {"Symbols"}
		local buffer = get_buffer()
		test.string_does_not_contain(buffer,'<LinkIncremental.*</LinkIncremental>')
	end
	
	function vs10_project_kinds.sharedLib_withoutOptimisation_linkIncrementalValueIsTrue()
		kind "SharedLib"
		local buffer = get_buffer()
		test.string_contains(buffer,'<LinkIncremental.*true</LinkIncremental>')
	end
	
	function vs10_project_kinds.sharedLib_withOptimisation_linkIncrementalValueIsFalse()
		kind "SharedLib"
		flags{"Optimize"}
		local buffer = get_buffer()
		test.string_contains(buffer,'<LinkIncremental.*false</LinkIncremental>')
	end
	
	--check all configs %(AdditionalIncludeDirectories) missing before AdditionalIncludeDirectories end tag in ClCompile
	function vs10_project_kinds.kindDoesNotMatter_noAdditionalDirectoriesSpecified_bufferDoesNotContainAdditionalIncludeDirectories()
		kind "SharedLib"
		local buffer = get_buffer()
		test.string_does_not_contain(buffer,'<ClCompile>.*<AdditionalIncludeDirectories>.*</ClCompile>')
	end
	
	function vs10_project_kinds.configType_configIsWindowedApp_resultComparesEqualToApplication()
		local t = { kind = "WindowedApp"}
		local result = premake.vstudio.vs10_helpers.config_type(t)
		test.isequal('Application',result)
	end
	
	function vs10_project_kinds.linkOptions_staticLib_bufferContainsAdditionalOptionsInSideLibTag()
		kind "StaticLib"
		linkoptions{'/dummyOption'}

		test.string_contains(get_buffer(),
			'<AdditionalOptions>.*%%%(AdditionalOptions%)</AdditionalOptions>.*</Lib>')
	end
	
	function vs10_project_kinds.noLinkOptions_staticLib_bufferDoesNotContainAdditionalOptionsInSideLibTag()
		kind "StaticLib"

		test.string_does_not_contain(get_buffer(),
			'<AdditionalOptions>.*%%%(AdditionalOptions%)</AdditionalOptions>.*</Lib>')
	end		
	
	function vs10_project_kinds.linkOptions_staticLib_bufferContainsPassedOption()
		kind "StaticLib"
		linkoptions{'/dummyOption'}

		test.string_contains(get_buffer(),
			'<AdditionalOptions>/dummyOption %%%(AdditionalOptions%)</AdditionalOptions>.*</Lib>')
	end	
	
	function vs10_project_kinds.linkOptions_windowedApp_bufferContainsAdditionalOptionsInSideLinkTag()
		kind "WindowedApp"
		linkoptions{'/dummyOption'}
		
		test.string_contains(get_buffer(),
			'<AdditionalOptions>.* %%%(AdditionalOptions%)</AdditionalOptions>.*</Link>')
	end	
	function vs10_project_kinds.linkOptions_consoleApp_bufferContainsAdditionalOptionsInSideLinkTag()
		kind "ConsoleApp"
		linkoptions{'/dummyOption'}
		
		test.string_contains(get_buffer(),
			'<AdditionalOptions>.* %%%(AdditionalOptions%)</AdditionalOptions>.*</Link>')
	end

	function vs10_project_kinds.linkOptions_sharedLib_bufferContainsAdditionalOptionsInSideLinkTag()
		kind "SharedLib"
		linkoptions{'/dummyOption'}
		
		test.string_contains(get_buffer(),
			'<AdditionalOptions>.* %%%(AdditionalOptions%)</AdditionalOptions>.*</Link>')
	end