Skip to content

Commit

Permalink
add test for reserved args
Browse files Browse the repository at this point in the history
  • Loading branch information
Mortimerp9 committed May 2, 2014
1 parent 750b0ba commit e5a6ede
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions core/src/test/scala/com/quantifind/sumac/ArgumentParserTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ class ArgumentParserTest extends FunSuite with Matchers {
}
}

test("reserved arguments should be filtered") {
val c = SimpleClass("a", 0, 1.4, 2)
val fieldArgs = classOf[SimpleClass].getDeclaredFields.map{f => FieldArgAssignable("",f, c)}
val argParser = new ArgumentParser(fieldArgs)

val parsed = getSimpleNameToArgMap(argParser.parse(Array("--count", "5", "--dummy", "7.4e3", "--name", "ooga", "--sumac.debugArgs", "true")))

parsed should not contain key("sumac.debugArgs")

}

def getSimpleNameToArgMap(parsedArgs : Map[_ <: ArgAssignable, ValueHolder[_]]) = {
parsedArgs.map{kv => kv._1.getName -> kv._2.value}.toMap[String, Any]
}
Expand Down

0 comments on commit e5a6ede

Please sign in to comment.