-
Notifications
You must be signed in to change notification settings - Fork 53
/
Copy pathMachineBlockerTests.cpp
34 lines (29 loc) · 1.01 KB
/
MachineBlockerTests.cpp
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
#include "catch2/catch.hpp"
#include "ApprovalTests/utilities/SystemUtils.h"
#include "ApprovalTests/Approvals.h"
#include "ApprovalTests/utilities/MachineBlocker.h"
using namespace ApprovalTests;
TEST_CASE("Blocks in this environment")
{
auto machineName = SystemUtils::getMachineName();
auto blocker = MachineBlocker::onMachineNamed(machineName);
REQUIRE(blocker.isBlockingOnThisMachine() == true);
}
TEST_CASE("Does not block in this environment")
{
auto machineName = SystemUtils::getMachineName();
auto blocker = MachineBlocker::onMachinesNotNamed(machineName);
REQUIRE(blocker.isBlockingOnThisMachine() == false);
}
// begin-snippet: machine_specific_test_runner
TEST_CASE("Only run this test on John's machine")
{
auto blocker = MachineBlocker::onMachinesNotNamed("JOHNS_MACHINE");
if (blocker.isBlockingOnThisMachine())
{
return;
}
// Write tests here that depend on John's environment.
REQUIRE(SystemUtils::getMachineName() == "JOHNS_MACHINE");
}
// end-snippet