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

host_args_tests.cpp « tests « host « src - github.com/windirstat/premake-4.x-stable.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b13e9702e6674c894dc70adb339381d3a34b8216 (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
/**
 * \file   host_args_tests.cpp
 * \brief  Automated tests for application command line argument processing.
 * \author Copyright (c) 2008 Jason Perkins and the Premake project
 */

#include "premake.h"
#include "testing/testing.h"
extern "C" {
#include "host/host.h"
#include "base/error.h"
#include "base/stream.h"
}

struct FxHostArgs
{
	Session sess;
	char buffer[8192];

	FxHostArgs()
	{
		sess = session_create();
		stream_set_buffer(Console, buffer);
	}

	~FxHostArgs()
	{
		session_destroy(sess);
		error_clear();
		host_set_argv(NULL);
	}
};


SUITE(host)
{
	TEST_FIXTURE(FxHostArgs, ParseArgv_SetsAction_OnAction)
	{
		const char* argv[] = { "premake", "action", NULL };
		host_set_argv(argv);
		host_parse_argv(sess);
		CHECK_EQUAL("action", session_get_action(sess));
	}
}