All Downloads are FREE. Search and download functionalities are using the official Maven repository.

sbt.testing.Fingerprints.scala Maven / Gradle / Ivy

The newest version!
/*
 * Scala.js (https://www.scala-js.org/)
 *
 * Copyright EPFL.
 *
 * Licensed under Apache License 2.0
 * (https://www.apache.org/licenses/LICENSE-2.0).
 *
 * See the NOTICE file distributed with this work for
 * additional information regarding copyright ownership.
 */

package sbt.testing

/** A way to identify test classes and/or modules that should be discovered
 *  when the client performs discovery.
 *
 *  Scala.js: Implementations may not rely on the identity of Fingerprints,
 *  since they are serialized between JS / JVM.
 */
trait Fingerprint

/** Indicates that classes or modules with a specific annotation, either on at
 *  least one top level method or on the class or module itself, should be
 *  discovered as test classes.
 */
trait AnnotatedFingerprint extends Fingerprint {
  /** Indicates whether modules with the annotation should be considered during
   *  discovery, or just classes.
   *
   *  If a test framework allows both classes and modules, they should return
   *  two different fingerprints from Framework.fingerprints, one
   *  that returns false for isModule and another
   *  that returns true.
   */
  def isModule(): Boolean

  /** The fully qualified name of the annotation that identifies classes or
   *  modules as test classes or modules to be discovered.
   */
  def annotationName(): String
}

/** Indicates that classes (and possibly modules) that extend a particular
 *  superclass, or mix in a particular supertrait, should be discovered as test
 *  classes.
 */
trait SubclassFingerprint extends Fingerprint {

  /** Indicates whether modules (singleton objects) that extend the superclass
   *  or supertrait should be considered during discovery, or just classes.
   *
   *  If modules are not allowed by the test framework, they should return
   *  false for isModule. Returning
   *  false will speed up discovery because classes for modules
   *  can be quickly bypassed.
   */
  def isModule(): Boolean

  /** The name of the superclass or supertrait that identifies classes (and
   *  possibly modules) as test classes to be discovered.
   */
  def superclassName(): String

  /** Indicates whether discovered classes must have a no-arg constructor.
   *
   *  If this method returns true, the client should not discover
   *  any subclass of the given superClassName that does not
   *  declare a no-arg constructor, i.e., a constructor that takes no
   *  arguments.
   */
  def requireNoArgConstructor(): Boolean
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy