public void testThreeToSix() throws Exception {
TestShell shell = new TestShell();
shell.addAlias("cmd", "org.jnode.test.shell.syntax.RepeatSyntaxTest$Test");
shell.addSyntax("cmd", new RepeatSyntax(new ArgumentSyntax("arg1"), 3, 6));
CommandLine cl;
CommandInfo cmdInfo;
@SuppressWarnings("unused")
Command cmd;
try {
cl = new CommandLine(new Token("cmd"), new Token[] {}, null);
cl.parseCommandLine(shell);
Assert.fail("no exception");
} catch (CommandSyntaxException ex) {
// expected
}
try {
cl = new CommandLine(new Token("cmd"), new Token[] {new Token("F1")}, null);
cl.parseCommandLine(shell);
} catch (CommandSyntaxException ex) {
// expected
}
try {
cl = new CommandLine(new Token("cmd"), new Token[] {new Token("F1"), new Token("F1")}, null);
cl.parseCommandLine(shell);
} catch (CommandSyntaxException ex) {
// expected
}
cl = new CommandLine(new Token("cmd"), new Token[] {new Token("F1"), new Token("F1"), new Token("F1")}, null);
cmdInfo = cl.parseCommandLine(shell);
cmd = cmdInfo.createCommandInstance();
cl = new CommandLine(new Token("cmd"), new Token[] {new Token("F1"), new Token("F1"), new Token("F1"),
new Token("F1")}, null);
cmdInfo = cl.parseCommandLine(shell);
cmd = cmdInfo.createCommandInstance();
cl = new CommandLine(new Token("cmd"), new Token[] {new Token("F1"), new Token("F1"), new Token("F1"),
new Token("F1"), new Token("F1")}, null);
cmdInfo = cl.parseCommandLine(shell);
cmd = cmdInfo.createCommandInstance();
cl = new CommandLine(new Token("cmd"), new Token[] {new Token("F1"), new Token("F1"), new Token("F1"),
new Token("F1"), new Token("F1"), new Token("F1")}, null);
cmdInfo = cl.parseCommandLine(shell);
cmd = cmdInfo.createCommandInstance();
try {
cl = new CommandLine(new Token("cmd"), new Token[] {new Token("F1"), new Token("F1"), new Token("F1"),
new Token("F1"), new Token("F1"), new Token("F1"), new Token("F1")}, null);
cl.parseCommandLine(shell);
Assert.fail("no exception");
} catch (CommandSyntaxException ex) {
// expected
}
}