-
Notifications
You must be signed in to change notification settings - Fork 7
/
MiscTest.java
39 lines (30 loc) · 1.11 KB
/
MiscTest.java
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
package com.bladecoder.ink.runtime.test;
import com.bladecoder.ink.runtime.Story;
import org.junit.Assert;
import org.junit.Test;
public class MiscTest {
/**
* Issue: https://github.com/bladecoder/blade-ink/issues/15
*/
@Test
public void issue15() throws Exception {
String json = TestUtils.getJsonString("inkfiles/misc/issue15.ink.json");
Story story = new Story(json);
Assert.assertEquals("This is a test\n", story.Continue());
while (story.canContinue()) {
// System.out.println(story.buildStringOfHierarchy());
String line = story.Continue();
if (line.startsWith("SET_X:")) {
story.getVariablesState().set("x", 100);
} else {
Assert.assertEquals("X is set\n", line);
}
}
}
@Test
public void testNewlinesWithStringEval() throws Exception {
String json = TestUtils.getJsonString("inkfiles/misc/newlines_with_string_eval.ink.json");
Story story = new Story(json);
Assert.assertEquals("A\n3\nB\n", story.continueMaximally());
}
}