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

host_results_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: ba646fc408e7b5c19cb7be2289a78010018eaecb (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
/**
 * \file   host_results_tests.cpp
 * \brief  Automated test for application status reporting.
 * \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 FxResults
{
	Session sess;
	char buffer[1024];

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

	~FxResults()
	{
		session_destroy(sess);
		error_clear();
	}
};


SUITE(host)
{
	TEST_FIXTURE(FxResults, ReportResults_NoMessage_OnNoError)
	{
		host_report_results(sess);
		CHECK_EQUAL("", buffer);
	}

	TEST_FIXTURE(FxResults, ReportResults_ErrorMessage_OnError)
	{
		error_set("an error occurred");
		host_report_results(sess);
		CHECK_EQUAL("Error: an error occurred\n", buffer);
	}
}