Parse into nested arguments

This commit is contained in:
Nathan Adams
2014-09-18 16:36:36 +02:00
parent a32243b704
commit 8d164e4b66
8 changed files with 97 additions and 17 deletions
@@ -4,7 +4,9 @@ import net.minecraft.commands.exceptions.IllegalCommandArgumentException;
import org.junit.Before;
import org.junit.Test;
import static net.minecraft.commands.arguments.IntegerArgumentType.integer;
import static net.minecraft.commands.builder.CommandBuilder.command;
import static net.minecraft.commands.builder.RequiredArgumentBuilder.argument;
public class LiteralCommandNodeTest {
LiteralCommandNode node;
@@ -23,4 +25,16 @@ public class LiteralCommandNodeTest {
public void testParseInvalid() throws Exception {
node.parse("bar");
}
@Test
public void testParseChild() throws Exception {
node.addChild(argument("bar", integer()).build());
node.parse("foo 123");
}
@Test(expected = IllegalCommandArgumentException.class)
public void testParseNoChildren() throws Exception {
node.parse("foo 123");
}
}