Skip to content

Commit

Permalink
Added new LIST_ALL test.
Browse files Browse the repository at this point in the history
  • Loading branch information
bladecoder committed Oct 28, 2023
1 parent b1c1e61 commit 3b4c09c
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -20,4 +20,4 @@ build/

*.log


.DS_Store
11 changes: 11 additions & 0 deletions src/test/java/com/bladecoder/ink/runtime/test/ListSpecTest.java
Expand Up @@ -131,4 +131,15 @@ public void testMoreListOperations2() throws Exception {
"a1, b1, c1\na1\na1, b2\ncount:2\nmax:c2\nmin:a1\ntrue\ntrue\nfalse\nempty\na2\na2, b2, c2\nrange:a1, b2\na1\nsubtract:a1, c1\nrandom:a1\nlistinc:b1\n",
story.continueMaximally());
}

@Test
public void testListAllBug() throws Exception {

String json = TestUtils.getJsonString("inkfiles/lists/list-all.ink.json");
Story story = new Story(json);

Assert.assertEquals(
"A, B\n",
story.continueMaximally());
}
}
3 changes: 3 additions & 0 deletions src/test/resources/inkfiles/lists/list-all.ink
@@ -0,0 +1,3 @@
LIST a = A
LIST b = B
{LIST_ALL(A + B)}
63 changes: 63 additions & 0 deletions src/test/resources/inkfiles/lists/list-all.ink.json
@@ -0,0 +1,63 @@
{
"inkVersion": 21,
"root": [
[
"ev",
{
"VAR?": "A"
},
{
"VAR?": "B"
},
"+",
"LIST_ALL",
"out",
"/ev",
"\n",
[
"done",
{
"#f": 5,
"#n": "g-0"
}
],
null
],
"done",
{
"global decl": [
"ev",
{
"list": {},
"origins": [
"a"
]
},
{
"VAR=": "a"
},
{
"list": {},
"origins": [
"b"
]
},
{
"VAR=": "b"
},
"/ev",
"end",
null
],
"#f": 1
}
],
"listDefs": {
"a": {
"A": 1
},
"b": {
"B": 1
}
}
}

0 comments on commit 3b4c09c

Please sign in to comment.