use of co.rsk.test.dsl.DslCommand in project rskj by rsksmart.
the class DslCommandTest method createCommandWithVerbAndTwoArguments.
@Test
public void createCommandWithVerbAndTwoArguments() {
List<String> args = new ArrayList<>();
args.add("arg1");
args.add("arg2");
DslCommand cmd = new DslCommand("verb", args);
Assert.assertTrue(cmd.isCommand("verb"));
Assert.assertEquals(2, cmd.getArity());
Assert.assertEquals("arg1", cmd.getArgument(0));
Assert.assertEquals("arg2", cmd.getArgument(1));
Assert.assertNull(cmd.getArgument(2));
}
use of co.rsk.test.dsl.DslCommand in project rskj by rsksmart.
the class DslParserTest method parseSimpleCommandWithAdditionalSpacesAndTabs.
@Test
public void parseSimpleCommandWithAdditionalSpacesAndTabs() {
DslParser parser = new DslParser(" do\t\t arg1 \t arg2 ");
DslCommand cmd = parser.nextCommand();
Assert.assertNotNull(cmd);
Assert.assertTrue(cmd.isCommand("do"));
Assert.assertEquals(2, cmd.getArity());
Assert.assertEquals("arg1", cmd.getArgument(0));
Assert.assertEquals("arg2", cmd.getArgument(1));
Assert.assertNull(parser.nextCommand());
}
use of co.rsk.test.dsl.DslCommand in project rskj by rsksmart.
the class DslParserTest method parseSimpleCommandSkippingEmptyLines.
@Test
public void parseSimpleCommandSkippingEmptyLines() {
DslParser parser = new DslParser(" \ndo arg1 arg2\n ");
DslCommand cmd = parser.nextCommand();
Assert.assertNotNull(cmd);
Assert.assertTrue(cmd.isCommand("do"));
Assert.assertEquals(2, cmd.getArity());
Assert.assertEquals("arg1", cmd.getArgument(0));
Assert.assertEquals("arg2", cmd.getArgument(1));
Assert.assertNull(parser.nextCommand());
}
use of co.rsk.test.dsl.DslCommand in project rskj by rsksmart.
the class DslParserTest method parseSimpleCommandWithNoArguments.
@Test
public void parseSimpleCommandWithNoArguments() {
DslParser parser = new DslParser("do");
DslCommand cmd = parser.nextCommand();
Assert.assertNotNull(cmd);
Assert.assertTrue(cmd.isCommand("do"));
Assert.assertEquals(0, cmd.getArity());
Assert.assertNull(parser.nextCommand());
}
Aggregations