Merge pull request #5014 from eatkins/fail-on-exception

Display only valid pages in scripted completions
This commit is contained in:
Ethan Atkins 2019-09-02 11:41:21 -07:00 committed by GitHub
commit 19ead4144d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View File

@ -136,8 +136,10 @@ object ScriptedPlugin extends AutoPlugin {
val groupP = token(id.examples(pairMap.keySet)) <~ token('/') val groupP = token(id.examples(pairMap.keySet)) <~ token('/')
// A parser for page definitions // A parser for page definitions
val pageP: Parser[ScriptedTestPage] = ("*" ~ NatBasic ~ "of" ~ NatBasic) map { val pageNumber = NatBasic & not('0', "zero page number")
case _ ~ page ~ _ ~ total => ScriptedTestPage(page, total) val pageP: Parser[ScriptedTestPage] = ("*" ~> pageNumber ~ ("of" ~> pageNumber)) flatMap {
case (page, total) if page <= total => success(ScriptedTestPage(page, total))
case (page, total) => failure(s"Page $page was greater than $total")
} }
// Grabs the filenames from a given test group in the current page definition. // Grabs the filenames from a given test group in the current page definition.

View File

@ -53,8 +53,10 @@ object Scripted {
val groupP = token(id.examples(pairMap.keySet)) <~ token('/') val groupP = token(id.examples(pairMap.keySet)) <~ token('/')
// A parser for page definitions // A parser for page definitions
val pageP: Parser[ScriptedTestPage] = ("*" ~ NatBasic ~ "of" ~ NatBasic) map { val pageNumber = NatBasic & not('0', "zero page number")
case _ ~ page ~ _ ~ total => ScriptedTestPage(page, total) val pageP: Parser[ScriptedTestPage] = ("*" ~> pageNumber ~ ("of" ~> pageNumber)) flatMap {
case (page, total) if page <= total => success(ScriptedTestPage(page, total))
case (page, total) => failure(s"Page $page was greater than $total")
} }
// Grabs the filenames from a given test group in the current page definition. // Grabs the filenames from a given test group in the current page definition.