aboutsummaryrefslogtreecommitdiff
path: root/src/test/scala/ParserTest.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/scala/ParserTest.scala')
-rw-r--r--src/test/scala/ParserTest.scala27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/test/scala/ParserTest.scala b/src/test/scala/ParserTest.scala
new file mode 100644
index 0000000..11694c4
--- /dev/null
+++ b/src/test/scala/ParserTest.scala
@@ -0,0 +1,27 @@
+package commando
+
+import utest._
+
+object ParserTest extends TestSuite {
+
+ implicit class EliteCommando(line: String) {
+ def parse(command: Command): Unit = {
+ val args = line.split(" ")
+ commando.parse(args, command)(err => throw new ParseException(err))
+ }
+ }
+
+ val tests = Tests {
+ "foo" - {
+ val command = cmd("cbx")(
+ opt("server", 'S', param = "url" -> false),
+ pos("number")
+ ).run(
+ ctx => println("yoyo, my context was: " + ctx)
+ )
+ "--server x 3 -S 5 --server=2 --server 2".parse(command)
+ println(command.usage)
+ }
+ }
+
+}