aboutsummaryrefslogtreecommitdiff
path: root/src/test/scala/ParserTest.scala
blob: 11694c4f56fe7d253417e1c920efe06041100df5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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)
    }
  }

}