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

make_config_tests.cpp « tests « make « actions « src - github.com/windirstat/premake-4.x-stable.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8c7c424d89d15735445de4cda098f6adda280538 (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
/**
 * \file   make_config_tests.cpp
 * \brief  Automated tests for makefile configuration block processing.
 * \author Copyright (c) 2002-2008 Jason Perkins and the Premake project
 */

#include "premake.h"
#include "actions/tests/action_tests.h"
extern "C" {
#include "actions/make/make_project.h"
#include "platform/platform.h"
}

SUITE(action)
{
	/**********************************************************************
	 * CPPFLAGS tests
	 **********************************************************************/

	TEST_FIXTURE(FxAction, MakeCppFlags_Defaults)
	{
		make_project_config_cppflags(sess, prj, strm);
		CHECK_EQUAL(
			"   CPPFLAGS += -MMD\n",
			buffer);
	}

	TEST_FIXTURE(FxAction, MakeCppFlags_WithDefines)
	{
		char* defines[] = { "DEFINE0", "DEFINE1", NULL};
		SetConfigField(prj, BlockDefines, defines);
		make_project_config_cppflags(sess, prj, strm);
		CHECK_EQUAL(
			"   CPPFLAGS += -MMD -D \"DEFINE0\" -D \"DEFINE1\"\n",
			buffer);
	}


	/**********************************************************************
	 * CFLAGS tests
	 **********************************************************************/

	TEST_FIXTURE(FxAction, MakeProject_Config_CFlags)
	{
		make_project_config_cflags(sess, prj, strm);
		CHECK_EQUAL(
			"   CFLAGS   += $(CPPFLAGS) $(ARCHFLAGS)\n",
			buffer);
	}


	/**********************************************************************
	 * CXXFLAGS tests
	 **********************************************************************/

	TEST_FIXTURE(FxAction, MakeProject_Config_CxxFlags)
	{
		make_project_config_cxxflags(sess, prj, strm);
		CHECK_EQUAL(
			"   CXXFLAGS += $(CFLAGS)\n",
			buffer);
	}


	/**********************************************************************
	 * LDDEPS tests
	 **********************************************************************/

	TEST_FIXTURE(FxAction, MakeProject_Config_LdDeps)
	{
		make_project_config_lddeps(sess, prj, strm);
		CHECK_EQUAL(
			"   LDDEPS   :=\n",
			buffer);
	}


	/**********************************************************************
	 * LDFLAGS tests
	 **********************************************************************/

	TEST_FIXTURE(FxAction, MakeProject_Config_LdFlags)
	{
		make_project_config_ldflags(sess, prj, strm);
		CHECK_EQUAL(
			"   LDFLAGS  +=\n",
			buffer);
	}


	/**********************************************************************
	 * OBJDIR tests
	 **********************************************************************/

	TEST_FIXTURE(FxAction, MakeProject_Config_ObjDir)
	{
		make_project_config_objdir(sess, prj, strm);
		CHECK_EQUAL(
			"   OBJDIR   := obj/Debug\\ DLL\n",
			buffer);
	}


	/**********************************************************************
	 * OUTFILE tests
	 **********************************************************************/

	TEST_FIXTURE(FxAction, MakeProject_Config_OutFile)
	{
		platform_set(MacOSX);
		make_project_config_outfile(sess, prj, strm);
		CHECK_EQUAL(
			"   OUTFILE  := $(OUTDIR)/My\\ Project\n",
			buffer);
	}


	/**********************************************************************
	 * OUTDIR tests
	 **********************************************************************/

	TEST_FIXTURE(FxAction, MakeProject_Config_OutDir)
	{
		make_project_config_outdir(sess, prj, strm);
		CHECK_EQUAL(
			"   OUTDIR   := .\n",
			buffer);
	}


	/**********************************************************************
	 * RESFLAGS tests
	 **********************************************************************/

	TEST_FIXTURE(FxAction, MakeProject_Config_ResFlags)
	{
		make_project_config_resflags(sess, prj, strm);
		CHECK_EQUAL(
			"   RESFLAGS +=\n",
			buffer);
	}
}