mirror of https://github.com/sbt/sbt.git
Deleted unused discovered test parser/printer
This commit is contained in:
parent
4bf4a80b5e
commit
ef4ce0f789
|
|
@ -3,23 +3,7 @@
|
|||
*/
|
||||
package sbt
|
||||
|
||||
/* The following implements the simple syntax for storing test definitions.
|
||||
* The syntax is:
|
||||
*
|
||||
* definition := isModule? className typeSpecific
|
||||
* isModule := '<module>'
|
||||
* typeSpecific := annotated | subclass
|
||||
*
|
||||
* subclass := subclassSeparator className
|
||||
* subclassSeparator := '<<'
|
||||
*
|
||||
* annotated := annotationSeparator annotationName
|
||||
* annotationSeparator := '@'
|
||||
*/
|
||||
|
||||
import scala.util.parsing.combinator._
|
||||
import testing.{Fingerprint, AnnotatedFingerprint, TestFingerprint}
|
||||
import DiscoveredParser._
|
||||
|
||||
sealed abstract class Discovered extends Fingerprint with NotNull
|
||||
{
|
||||
|
|
@ -42,32 +26,3 @@ final case class DiscoveredAnnotated(isModule: Boolean, className: String, annot
|
|||
override def toString =
|
||||
(if(isModule) IsModuleLiteral else "") + className + AnnotationSeparator + annotationName
|
||||
}
|
||||
final class DiscoveredParser extends RegexParsers with NotNull
|
||||
{
|
||||
def definition: Parser[Discovered] =
|
||||
( isModule ~! className ~! (SubSuperSeparator | AnnotationSeparator) ~! className ) ^^ {
|
||||
case module ~ name ~ SubSuperSeparator ~ superName => DiscoveredSubclass(module, name.trim, superName.trim)
|
||||
case module ~ name ~ AnnotationSeparator ~ annotation => DiscoveredAnnotated(module, name.trim, annotation.trim)
|
||||
}
|
||||
|
||||
def isModule: Parser[Boolean] = (IsModuleLiteral?) ^^ (_.isDefined)
|
||||
def className: Parser[String] = ClassNameRegexString.r
|
||||
|
||||
def parse(definitionString: String): Either[String, Discovered] =
|
||||
{
|
||||
def parseError(msg: String) = Left("Could not parse discovered definition '" + definitionString + "': " + msg)
|
||||
parseAll(definition, definitionString) match
|
||||
{
|
||||
case Success(result, next) => Right(result)
|
||||
case err: NoSuccess => parseError(err.msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
object DiscoveredParser
|
||||
{
|
||||
val IsModuleLiteral = "<module>"
|
||||
val SubSuperSeparator = "<<"
|
||||
val AnnotationSeparator = "@"
|
||||
val ClassNameRegexString = """[^@<]+"""
|
||||
def parse(definitionString: String): Either[String, Discovered] = (new DiscoveredParser).parse(definitionString)
|
||||
}
|
||||
Loading…
Reference in New Issue