use of co.rsk.test.dsl.DslCommand in project rskj by rsksmart.
the class DslCommandTest method createCommandWithVerbAndNoArguments.
@Test
public void createCommandWithVerbAndNoArguments() {
DslCommand cmd = new DslCommand("verb");
Assert.assertTrue(cmd.isCommand("verb"));
Assert.assertEquals(0, cmd.getArity());
Assert.assertNull(cmd.getArgument(0));
}
use of co.rsk.test.dsl.DslCommand in project rskj by rsksmart.
the class DslParserTest method parseTwoSimpleCommands.
@Test
public void parseTwoSimpleCommands() {
DslParser parser = new DslParser("do1 arg11 arg12\ndo2 arg21 arg22");
DslCommand cmd = parser.nextCommand();
Assert.assertNotNull(cmd);
Assert.assertTrue(cmd.isCommand("do1"));
Assert.assertEquals(2, cmd.getArity());
Assert.assertEquals("arg11", cmd.getArgument(0));
Assert.assertEquals("arg12", cmd.getArgument(1));
cmd = parser.nextCommand();
Assert.assertNotNull(cmd);
Assert.assertTrue(cmd.isCommand("do2"));
Assert.assertEquals(2, cmd.getArity());
Assert.assertEquals("arg21", cmd.getArgument(0));
Assert.assertEquals("arg22", cmd.getArgument(1));
Assert.assertNull(parser.nextCommand());
}
use of co.rsk.test.dsl.DslCommand in project rskj by rsksmart.
the class DslParserTest method parseSimpleCommand.
@Test
public void parseSimpleCommand() {
DslParser parser = new DslParser("do arg1 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 parseSimpleCommandSkippingComment.
@Test
public void parseSimpleCommandSkippingComment() {
DslParser parser = new DslParser("do arg1 arg2 # this is a comment");
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 parseSimpleCommandSkippingCommentLines.
@Test
public void parseSimpleCommandSkippingCommentLines() {
DslParser parser = new DslParser("# first comment \ndo arg1 arg2\n # second comment ");
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());
}
Aggregations