File: test_config.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 (58 lines) | stat: -rw-r--r-- 1,197 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
--
-- tests/test_config.lua
-- Automated test suite for the configuration handling functions.
-- Copyright (c) 2010 Jason Perkins and the Premake project
--

	T.config = { }
	local suite = T.config


--
-- Setup/Teardown
--

	function suite.setup()
		sln = test.createsolution()
	end

	local cfg
	local function prepare()
		io.capture()
		premake.buildconfigs()
		cfg = premake.solution.getproject(sln, 1)
	end


--
-- Debug/Release build testing
--

	function suite.IsDebug_ReturnsFalse_OnOptimizeFlag()
		flags { "Optimize" }
		prepare()
		return test.isfalse(premake.config.isdebugbuild(cfg))
	end

	function suite.IsDebug_ReturnsFalse_OnOptimizeSizeFlag()
		flags { "OptimizeSize" }
		prepare()
		return test.isfalse(premake.config.isdebugbuild(cfg))
	end

	function suite.IsDebug_ReturnsFalse_OnOptimizeSpeedFlag()
		flags { "OptimizeSpeed" }
		prepare()
		return test.isfalse(premake.config.isdebugbuild(cfg))
	end

	function suite.IsDebug_ReturnsFalse_OnNoSymbolsFlag()
		prepare()
		return test.isfalse(premake.config.isdebugbuild(cfg))
	end

	function suite.IsDebug_ReturnsTrue_OnSymbolsFlag()
		flags { "Symbols" }
		prepare()
		return test.istrue(premake.config.isdebugbuild(cfg))
	end