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

test_merging.lua « baking « tests - github.com/windirstat/premake-4.x-stable.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6cce7d9a1d7aa81784570e5e70fc633844efe79f (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
--
-- tests/baking/test_merging.lua
-- Verifies different field types are merged properly during baking.
-- Copyright (c) 2011 Jason Perkins and the Premake project
--

	T.baking_merging = { }
	local suite = T.baking_merging

--
-- Setup code
--

	local sln, prj, cfg
	function suite.setup()
		sln = solution "MySolution"
		configurations { "Debug", "Release" }		
	end

	local function prepare()
		premake.bake.buildconfigs()
		prj = premake.solution.getproject(sln, 1)
	end
	

--
-- String value tests
--

	function suite.Strings_AreReplaced()
		kind "SharedLib"
		project "MyProject"
		kind "StaticLib"
		prepare()
		test.isequal("StaticLib", prj.kind)
	end

	function suite.Strings_KeepPreviousValue()
		kind "SharedLib"
		project "MyProject"
		prepare()
		test.isequal("SharedLib", prj.kind)
	end
		

--
-- List tests
--

	function suite.Lists_KeepPreviousValue()
		project "MyProject"
		prepare()
		test.isequal("Debug:Release", table.concat(prj.configurations, ":"))
	end
	
	function suite.Lists_AreJoined()
		defines { "SOLUTION" }
		project "MyProject"
		defines { "PROJECT" }
		prepare()
		test.isequal("SOLUTION:PROJECT", table.concat(prj.defines, ":"))
	end

	function suite.Lists_RemoveDuplicates()
		defines { "SOLUTION", "DUPLICATE" }
		project "MyProject"
		defines { "PROJECT", "DUPLICATE" }
		prepare()
		test.isequal("SOLUTION:DUPLICATE:PROJECT", table.concat(prj.defines, ":"))
	end
	
	function suite.Lists_FlattensNestedTables()
		defines { "ROOT", { "NESTED" } }
		project "MyProject"
		prepare()
		test.isequal("ROOT:NESTED", table.concat(prj.defines, ":"))
	end
		
	
--
-- Key/value tests
--

	function suite.KeyValue_AreMerged()
		vpaths { ["Solution"] = "*.sln" }
		project "MyProject"
		vpaths { ["Project"] = "*.prj" }
		prepare()
		test.isequal({"*.sln"}, prj.vpaths["Solution"])
		test.isequal({"*.prj"}, prj.vpaths["Project"])
	end
	
	function suite.KeyValue_MergesValues()
		vpaths { ["Solution"] = "*.sln", ["Project"] = "*.prj" }
		project "MyProject"
		vpaths { ["Project"] = "*.prjx" }
		prepare()
		test.isequal({"*.prj","*.prjx"}, prj.vpaths["Project"])
	end