Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import com.github.lolgab.mill.mima._

val scala212 = "2.12.17"
val scala213 = "2.13.10"
val scala3 = "3.1.3"
val scala3 = "3.3.1"

val osLib = "0.9.1"
val acyclic = "0.3.9"
Expand Down
26 changes: 26 additions & 0 deletions mainargs/test/src/TraitTests.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package mainargs
import utest._

object TraitTests extends TestSuite {

trait CommandList {
@main
def list(@arg v: String) = v
}

trait CommandCopy {
@main
def copy(@arg from: String, @arg to: String) = (from, to)
}

object Main extends CommandList with CommandCopy {
def main(args: Array[String]): Unit = ParserForMethods(this).runOrExit(args)
}

val tests = Tests {
test("explicit") {
ParserForMethods(Main).runOrThrow(Array("list", "-v", "hello")) ==> "hello"
ParserForMethods(Main).runOrThrow(Array("copy", "--from", "hello", "--to", "world")) ==> ("hello", "world")
}
}
}