-
-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathEmptyStringForDivert.cpp
More file actions
36 lines (32 loc) · 923 Bytes
/
EmptyStringForDivert.cpp
File metadata and controls
36 lines (32 loc) · 923 Bytes
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
#include "catch.hpp"
#include <story.h>
#include <globals.h>
#include <runner.h>
#include <compiler.h>
using namespace ink::runtime;
SCENARIO("a story with a white space infront of an conditional Divert", "[Output]")
{
// based on https://github.com/JBenda/inkcpp/issues/71
GIVEN("A story")
{
std::unique_ptr<story> ink{story::from_file(INK_TEST_RESOURCE_DIR "EmptyStringForDivert.bin")};
runner thread = ink->new_runner();
WHEN("run")
{
THEN("print 'This displays first'")
{
thread->getall();
REQUIRE(thread->has_choices());
thread->choose(0);
REQUIRE(thread->getall() == "This displays first\n");
REQUIRE(thread->has_choices());
thread->choose(0);
REQUIRE(thread->getall() == "This is the continuation.\n");
REQUIRE(thread->has_choices());
thread->choose(0);
REQUIRE(thread->getall() == "");
REQUIRE(! thread->has_choices());
}
}
}
}