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

test_gcc.lua « tools « tests - github.com/windirstat/premake-4.x.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c7fed8441c25d92955c2d57c595e16af2957d723 (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
--
-- tests/test_gcc.lua
-- Automated test suite for the GCC toolset interface.
-- Copyright (c) 2009-2011 Jason Perkins and the Premake project
--

	T.gcc = { }
	local suite = T.gcc

	local cfg
	function suite.setup()
		cfg = { }
		cfg.basedir    = "."
		cfg.location   = "."
		cfg.language   = "C++"
		cfg.project    = { name = "MyProject" }
		cfg.flags      = { }
		cfg.objectsdir = "obj"
		cfg.platform   = "Native"
		cfg.links      = { }
		cfg.libdirs    = { }
		cfg.linktarget = { fullpath="libMyProject.a" }
	end


--
-- CPPFLAGS tests
--

	function suite.cppflags_OnWindows()
		cfg.system = "windows"
		local r = premake.gcc.getcppflags(cfg)
		test.isequal("-MMD -MP", table.concat(r, " "))
	end

	function suite.cppflags_OnHaiku()
		cfg.system = "haiku"
		local r = premake.gcc.getcppflags(cfg)
		test.isequal("-MMD", table.concat(r, " "))
	end

		

--
-- CFLAGS tests
--

	function suite.cflags_SharedLib_Windows()
		cfg.kind = "SharedLib"
		cfg.system = "windows"
		local r = premake.gcc.getcflags(cfg)
		test.isequal('', table.concat(r,"|"))
	end


	function suite.cflags_OnFpFast()
		cfg.flags = { "FloatFast" }
		local r = premake.gcc.getcflags(cfg)
		test.isequal('-ffast-math', table.concat(r,"|"))
	end


	function suite.cflags_OnFpStrict()
		cfg.flags = { "FloatStrict" }
		local r = premake.gcc.getcflags(cfg)
		test.isequal('-ffloat-store', table.concat(r,"|"))
	end


--
-- LDFLAGS tests
--

	function suite.ldflags_SharedLib_Windows()
		cfg.kind = "SharedLib"
		cfg.system = "windows"
		local r = premake.gcc.getldflags(cfg)
		test.isequal('-s|-shared|-Wl,--out-implib="libMyProject.a"', table.concat(r,"|"))
	end


	function suite.linkflags_OnFrameworks()
		cfg.links = { "Cocoa.framework" }
		local r = premake.gcc.getlinkflags(cfg)
		test.isequal('-framework Cocoa', table.concat(r,"|"))
	end