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

host_run_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: 0ee7391b61a174f370bfe1c78a2a70adaa37a898 (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
/**
 * \file   host_run_tests.cpp
 * \brief  Automated test for the host script execution logic.
 * \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/dir.h"
#include "base/error.h"
}

struct FxHostRun
{
	Host host;

	FxHostRun()
	{
		host = host_create();
		dir_set_current("testing/test_files");
	}

	~FxHostRun()
	{
		dir_set_current("../..");
		host_destroy(host);
		error_clear();
	}
};

SUITE(host)
{
	/**********************************************************************
	 * host_run_action() tests
	 **********************************************************************/

	TEST_FIXTURE(FxHostRun, HostRunAction_ReturnsNotOkay_OnInvalidAction)
	{
		const char* argv[] = { "premake", "nonesuch", NULL };
		host_set_argv(host, argv);
		int result = host_run_action(host);
		CHECK(result != OKAY);
	}

	TEST_FIXTURE(FxHostRun, HostRunAction_SetsError_OnInvalidAction)
	{
		const char* argv[] = { "premake", "nonesuch", NULL };
		host_set_argv(host, argv);
		host_run_action(host);
		CHECK_EQUAL("invalid action 'nonesuch'", error_get());
	}
}