package org.spoofax.jsglr2.integrationtest.grammars;

import org.junit.Test;
import org.spoofax.jsglr2.integrationtest.BaseTestWithSdf3ParseTables;
import org.spoofax.terms.ParseError;

public class ListsTest extends BaseTestWithSdf3ParseTables {

    public ListsTest() {
        super("lists.sdf3");
    }

    @Test public void testEmpty() throws ParseError {
        testSuccessByExpansions("", "amb([ZeroOrMoreXs([]),ZeroOrMoreXsCommaSeparated([])])");
    }

    @Test public void testSingleX() throws ParseError {
        testSuccessByExpansions("x",
            "amb([ZeroOrMoreXs([X]),ZeroOrMoreXsCommaSeparated([X]),OneOrMoreXs([X]),OneOrMoreXsCommaSeparated([X])])");
    }

    @Test public void testTwoLayoutSeparatedXs() throws ParseError {
        testSuccessByExpansions("x x", "amb([ZeroOrMoreXs([X, X]), OneOrMoreXs([X, X])])");
    }

    @Test public void testTwoCommaSeparatedXs() throws ParseError {
        testSuccessByExpansions("x,x", "amb([ZeroOrMoreXsCommaSeparated([X, X]), OneOrMoreXsCommaSeparated([X, X])])");
    }

    @Test public void testThreeLayoutSeparatedXs() throws ParseError {
        testSuccessByExpansions("x x x", "amb([ZeroOrMoreXs([X, X, X]), OneOrMoreXs([X, X, X])])");
    }

    @Test public void testThreeCommaSeparatedXs() throws ParseError {
        testSuccessByExpansions("x,x , x",
            "amb([ZeroOrMoreXsCommaSeparated([X, X, X]), OneOrMoreXsCommaSeparated([X, X, X])])");
    }

}
@@ -70,16 +70,68 @@
 t.Test;%0A
+import org.spoofax.jsglr2.incremental.EditorUpdate;%0A
 import o
@@ -1491,9 +1491,482 @@
 %0A    %7D%0A%0A
+    @Test public void testIncrementalLayoutSeparatedXs() throws ParseError %7B%0A        testIncrementalSuccessByExpansions(%22x x x%22,%0A            new EditorUpdate%5B%5D %7B new EditorUpdate(4, 4, %22x %22), new EditorUpdate(1, 3, %22%22), %7D,%0A            new String%5B%5D %7B %22amb(%5BZeroOrMoreXs(%5BX, X, X%5D), OneOrMoreXs(%5BX, X, X%5D)%5D)%22,%0A                %22amb(%5BZeroOrMoreXs(%5BX, X, X, X%5D), OneOrMoreXs(%5BX, X, X, X%5D)%5D)%22,%0A                %22amb(%5BZeroOrMoreXs(%5BX, X, X%5D), OneOrMoreXs(%5BX, X, X%5D)%5D)%22, %7D);%0A    %7D%0A%0A
 %7D

Add incremental test with lists