When parsing nodes, return the deepest node we went into

This commit is contained in:
Nathan Adams
2014-09-22 15:20:57 +02:00
parent 8d164e4b66
commit 397ab17e64
5 changed files with 28 additions and 17 deletions
@@ -6,6 +6,8 @@ import org.junit.Test;
import static net.minecraft.commands.arguments.IntegerArgumentType.integer;
import static net.minecraft.commands.builder.RequiredArgumentBuilder.argument;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
public class ArgumentCommandNodeTest {
ArgumentCommandNode node;
@@ -17,7 +19,7 @@ public class ArgumentCommandNodeTest {
@Test
public void testParse() throws Exception {
node.parse("123");
assertThat((ArgumentCommandNode) node.parse("123"), is(node));
}
@Test(expected = IllegalCommandArgumentException.class)
@@ -27,9 +29,11 @@ public class ArgumentCommandNodeTest {
@Test
public void testParseChild() throws Exception {
node.addChild(argument("bar", integer()).build());
CommandNode child = argument("bar", integer()).build();
node.parse("123 123");
node.addChild(child);
assertThat(node.parse("123 123"), is(child));
}
@Test(expected = IllegalCommandArgumentException.class)