blob: 6b95ed1d4f99ff97d82dc4c53f5a1744ca8251e7 (
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 fn_include_tests.cpp
* \brief Automated test for the include() function.
* \author Copyright (c) 2008 Jason Perkins and the Premake project
*/
#include "premake.h"
#include "testing/testing.h"
extern "C" {
#include "engine/session.h"
#include "base/cstr.h"
#include "base/error.h"
}
struct FnInclude
{
Session sess;
FnInclude()
{
sess = session_create();
}
~FnInclude()
{
session_destroy(sess);
error_clear();
}
};
SUITE(engine)
{
TEST_FIXTURE(FnInclude, Include_Exists_OnStartup)
{
const char* result = session_run_string(sess,
"return (include ~= nil)");
CHECK_EQUAL("true", result);
}
TEST_FIXTURE(FnInclude, Include_ReturnsValue_OnPremake4Found)
{
const char* result = session_run_string(sess,
"return include('testing/test_files')");
CHECK_EQUAL("true", result);
}
TEST_FIXTURE(FnInclude, Include_SetsError_OnFileNotFound)
{
session_run_string(sess,
"include('testing')");
CHECK(cstr_ends_with(error_get(), "No such file or directory"));
}
}
|