Skip to content

Commit 8e69a16

Browse files
committed
test for single line matrix. closes #5
1 parent 0165530 commit 8e69a16

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/test/java/com/singingbush/sdl/SdlTest.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,17 @@ public void testMatrix3() throws IOException, SDLParseException {
618618
list(list(1,2,3),list(4,5,6)));
619619
}
620620

621+
@Test
622+
public void testMatrix4() throws IOException, SDLParseException {
623+
final InputStreamReader inputStream = loadTestResource("test_structures.sdl");
624+
final Tag root = new Tag("root").read(inputStream);
625+
626+
final Tag t = root.getChild("matrix4");
627+
628+
assertEquals("matrix should be a list of lists", t.getChildrenValues("content"),
629+
list(list(1,2,3),list(4,5,6)));
630+
}
631+
621632
@Test
622633
public void testSemicolonsWithTwoLines() throws IOException, SDLParseException {
623634
final InputStreamReader inputStream = loadTestResource("test_structures.sdl");

src/test/resources/test_structures.sdl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ matrix3 {
135135
1 2 3; 4 5 6
136136
}
137137

138+
// correct way to do single line matrix in SDL (as per https://github.com/Abscissa/SDLang-D/issues/59)
139+
matrix4 {; 1 2 3; 4 5 6; }
140+
138141
# Test semicolons
139142

140143
twoLines {

0 commit comments

Comments
 (0)