Welcome to mirror list, hosted at ThFree Co, Russian Federation.

test_baking.lua « base « tests - github.com/windirstat/premake-4.x-stable.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c8168cecf39865b2a93f89c77d2d4b0facaf1e98 (plain)
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
--
-- tests/test_baking.lua
-- Automated test suite for the configuration baking functions.
-- Copyright (c) 2009, 2010 Jason Perkins and the Premake project
--

	T.baking = { }
	local suite = T.baking

--
-- Setup code
--

	local prj, cfg
	function suite.setup()
		_ACTION = "gmake"
		
		solution "MySolution"
		configurations { "Debug", "Release" }
		platforms { "x32", "ps3" }
		
		defines "SOLUTION"
		
		configuration "Debug"
		defines "SOLUTION_DEBUG"
		
		prj = project "MyProject"
		language "C"
		kind "SharedLib"
		targetdir "../bin"
		defines "PROJECT"
		
		configuration "Debug"
		defines "DEBUG"
		  
		configuration "Release"
		defines "RELEASE"

		configuration "native"
		defines "NATIVE"
		
		configuration "x32"
		defines "X86_32"
		
		configuration "x64"
		defines "X86_64"
	end

	local function prepare()
		premake.bake.buildconfigs()
		prj = premake.getconfig(prj)
		cfg = premake.getconfig(prj, "Debug")
	end
	

--
-- Tests
--

	function suite.ProjectWideSettings()
		prepare()
		test.isequal("SOLUTION:PROJECT:NATIVE", table.concat(prj.defines,":"))
	end

	
	function suite.BuildCfgSettings()
		prepare()
		test.isequal("SOLUTION:SOLUTION_DEBUG:PROJECT:DEBUG:NATIVE", table.concat(cfg.defines,":"))
	end


	function suite.PlatformSettings()
		prepare()
		local cfg = premake.getconfig(prj, "Debug", "x32")
		test.isequal("SOLUTION:SOLUTION_DEBUG:PROJECT:DEBUG:X86_32", table.concat(cfg.defines,":"))
	end

			
	function suite.SetsConfigName()
		prepare()
		local cfg = premake.getconfig(prj, "Debug", "x32")
		test.isequal("Debug", cfg.name)
	end

	
	function suite.SetsPlatformName()
		prepare()
		local cfg = premake.getconfig(prj, "Debug", "x32")
		test.isequal("x32", cfg.platform)
	end

	
	function suite.SetsPlatformNativeName()
		test.isequal("Native", cfg.platform)
	end

	
	function suite.SetsShortName()
		prepare()
		local cfg = premake.getconfig(prj, "Debug", "x32")
		test.isequal("debug32", cfg.shortname)
	end

	
	function suite.SetsNativeShortName()
		prepare()
		test.isequal("debug", cfg.shortname)
	end

	
	function suite.SetsLongName()
		prepare()
		local cfg = premake.getconfig(prj, "Debug", "x32")
		test.isequal("Debug|x32", cfg.longname)
	end

	
	function suite.SetsNativeLongName()
		prepare()
		test.isequal("Debug", cfg.longname)
	end

	
	function suite.SetsProject()
		prepare()
		local cfg = premake.getconfig(prj, "Debug", "x32")
		test.istrue(prj.project == cfg.project)
	end



--
-- Target system testing
--

	function suite.SetsTargetSystem_OnNative()
		prepare()
		test.isequal(os.get(), cfg.system)
	end

	function suite.SetTargetSystem_OnCrossCompiler()
		prepare()
		local cfg = premake.getconfig(prj, "Debug", "PS3")
		test.isequal("PS3", cfg.system)
	end


	
--
-- Configuration-specific kinds
--

	function suite.SetsConfigSpecificKind()
		configuration "Debug"
		kind "ConsoleApp"
		prepare()
		test.isequal("ConsoleApp", cfg.kind)
	end


--
-- Platform kind translation
--

	function suite.SetsTargetKind_OnSupportedKind()
		prepare()
		test.isequal("SharedLib", cfg.kind)
	end

	function suite.SetsTargetKind_OnUnsupportedKind()
		prepare()
		local cfg = premake.getconfig(prj, "Debug", "PS3")
		test.isequal("StaticLib", cfg.kind)
	end