scala.tools.nsc.interactive.tests

InteractiveTest

abstract class InteractiveTest extends AskParse with AskShutdown with AskReload with AskLoadedTyped with PresentationCompilerInstance with CoreTestDefs with InteractiveTestSettings

A base class for writing interactive compiler tests.

This class tries to cover common functionality needed when testing the presentation compiler: instantiation source files, reloading, creating positions, instantiating the presentation compiler, random stress testing.

By default, this class loads all scala and java classes found under src/, going recursively into subfolders. Loaded classes are found in sourceFiles. trait TestResources The presentation compiler is available through compiler.

It is easy to test member completion, type and hyperlinking at a given position. Source files are searched for TextMarkers. By default, the completion marker is /*!*/, the typedAt marker is /*?*/ and the hyperlinking marker is /*#*/. Place these markers in your source files, and the test framework will automatically pick them up and test the corresponding actions. Sources are reloaded by askReload(sourceFiles) (blocking call). All ask operations are placed on the work queue without waiting for each one to complete before asking the next. After all asks, it waits for each response in turn and prints the result. The default timeout is 1 second per operation.

To define a custom operation you have to:

(1) Define a new marker by extending TestMarker (2) Provide an implementation for the operation you want to check by extending PresentationCompilerTestDef (3) Add the class defined in (1) to the set of executed test actions by calling ++ on InteractiveTest.

Then you can simply use the new defined marker in your test sources and the testing framework will automatically pick it up.

Self Type
InteractiveTest
See also

Check existing tests under test/files/presentation

Linear Supertypes
InteractiveTestSettings, CoreTestDefs, PresentationCompilerRequestsWorkingMode, TestResources, PresentationCompilerInstance, TestSettings, AskLoadedTyped, AskReload, AskShutdown, AskParse, AskCommand, AnyRef, Any
Type Hierarchy Learn more about scaladoc diagrams
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. InteractiveTest
  2. InteractiveTestSettings
  3. CoreTestDefs
  4. PresentationCompilerRequestsWorkingMode
  5. TestResources
  6. PresentationCompilerInstance
  7. TestSettings
  8. AskLoadedTyped
  9. AskReload
  10. AskShutdown
  11. AskParse
  12. AskCommand
  13. AnyRef
  14. Any
Implicitly
  1. by any2stringadd
  2. by any2stringfmt
  3. by any2ArrowAssoc
  4. by any2Ensuring
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new InteractiveTest()

Type Members

  1. class CompletionAction extends PresentationCompilerTestDef with AskCompletionAt

    Ask the presentation compiler for completion at all locations (in all sources) where the defined marker is found.

    Ask the presentation compiler for completion at all locations (in all sources) where the defined marker is found.

    Definition Classes
    CoreTestDefs
  2. class HyperlinkAction extends PresentationCompilerTestDef with AskTypeAt with AskCompletionAt

    Ask the presentation compiler for hyperlink at all locations (in all sources) where the defined marker is found.

    Ask the presentation compiler for hyperlink at all locations (in all sources) where the defined marker is found.

    Definition Classes
    CoreTestDefs
  3. class TypeAction extends PresentationCompilerTestDef with AskTypeAt

    Ask the presentation compiler for type info at all locations (in all sources) where the defined marker is found.

    Ask the presentation compiler for type info at all locations (in all sources) where the defined marker is found.

    Definition Classes
    CoreTestDefs

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. def +(other: String): String

    Implicit information
    This member is added by an implicit conversion from InteractiveTest to StringAdd performed by method any2stringadd in scala.Predef.
    Definition Classes
    StringAdd
  5. def ++(tests: PresentationCompilerTestDef*): Unit

    Add new presentation compiler actions to test.

    Add new presentation compiler actions to test. Presentation compiler's test need to extends trait PresentationCompilerTestDef.

    Attributes
    protected
  6. def ->[B](y: B): (InteractiveTest, B)

    Implicit information
    This member is added by an implicit conversion from InteractiveTest to ArrowAssoc[InteractiveTest] performed by method any2ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  7. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  8. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  9. final val TIMEOUT: Int(10000)

    Attributes
    protected
    Definition Classes
    TestSettings
  10. val argsString: String

    If there's a file ending in .

    If there's a file ending in .opts, read it and parse it for cmd line arguments.

    Attributes
    protected
    Definition Classes
    InteractiveTestSettings
  11. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  12. def ask[T](op: (Response[T]) ⇒ Unit): Response[T]

    Presentation compiler's askXXX actions work by doing side-effects on a Response instance passed as an argument during the askXXX call.

    Presentation compiler's askXXX actions work by doing side-effects on a Response instance passed as an argument during the askXXX call. The defined method ask is meant to encapsulate this behavior.

    Attributes
    protected
    Definition Classes
    AskCommand
  13. def askAllSources[T]: (TestMarker) ⇒ ((Position) ⇒ Response[T]) ⇒ ((Position, T) ⇒ Unit) ⇒ Unit

    Attributes
    protected
    Definition Classes
    PresentationCompilerRequestsWorkingMode
  14. def askLoadedTyped(source: SourceFile)(implicit reporter: Reporter): Response[Global.Tree]

    Attributes
    protected
    Definition Classes
    AskLoadedTyped
  15. def askParse(sources: Seq[SourceFile]): Unit

    sources need to be entirely parsed before running the test (else commands such as AskCompletionAt may fail simply because the source's AST is not yet loaded).

    sources need to be entirely parsed before running the test (else commands such as AskCompletionAt may fail simply because the source's AST is not yet loaded).

    Definition Classes
    AskParse
  16. def askReload(sources: Seq[SourceFile])(implicit reporter: Reporter): Response[Unit]

    Reload the given source files and wait for them to be reloaded.

    Reload the given source files and wait for them to be reloaded.

    Attributes
    protected
    Definition Classes
    AskReload
  17. def askShutdown(): Unit

    Definition Classes
    AskShutdown
  18. val baseDir: Path

    The base directory for this test, usually a subdirectory of "test/files/presentation/"

    The base directory for this test, usually a subdirectory of "test/files/presentation/"

    Attributes
    protected
    Definition Classes
    TestSettings
  19. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  20. lazy val compiler: Global

    Attributes
    protected
    Definition Classes
    PresentationCompilerInstance
  21. val compilerReporter: Reporter

    Attributes
    protected
    Definition Classes
    PresentationCompilerInstance
  22. def ensuring(cond: (InteractiveTest) ⇒ Boolean, msg: ⇒ Any): InteractiveTest

    Implicit information
    This member is added by an implicit conversion from InteractiveTest to Ensuring[InteractiveTest] performed by method any2Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  23. def ensuring(cond: (InteractiveTest) ⇒ Boolean): InteractiveTest

    Implicit information
    This member is added by an implicit conversion from InteractiveTest to Ensuring[InteractiveTest] performed by method any2Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  24. def ensuring(cond: Boolean, msg: ⇒ Any): InteractiveTest

    Implicit information
    This member is added by an implicit conversion from InteractiveTest to Ensuring[InteractiveTest] performed by method any2Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  25. def ensuring(cond: Boolean): InteractiveTest

    Implicit information
    This member is added by an implicit conversion from InteractiveTest to Ensuring[InteractiveTest] performed by method any2Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  26. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  27. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  28. def execute(): Unit

    Attributes
    protected
  29. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  30. def formatted(fmtstr: String): String

    Implicit information
    This member is added by an implicit conversion from InteractiveTest to StringFormat performed by method any2stringfmt in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  31. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  32. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  33. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  34. def loadSources(): Unit

    Load all sources before executing the test.

    Load all sources before executing the test.

    Attributes
    protected
  35. def main(args: Array[String]): Unit

    Test's entry point

  36. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  37. final def notify(): Unit

    Definition Classes
    AnyRef
  38. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  39. val outDir: Path

    The root directory for this test suite, usually the test kind ("test/files/presentation").

    The root directory for this test suite, usually the test kind ("test/files/presentation").

    Attributes
    protected
    Definition Classes
    TestSettings
  40. def prepareSettings(settings: Settings): Unit

    Prepare the settings object.

    Prepare the settings object. Load the .opts file and adjust all paths from the Unix-like syntax to the platform specific syntax. This is necessary so that a single .opts file can be used on all platforms.

    Attributes
    protected
    Definition Classes
    InteractiveTestSettings → PresentationCompilerInstance
    Note

    Bootclasspath is treated specially. If there is a -bootclasspath option in the file, the 'usejavacp' setting is set to false. This ensures that the bootclasspath takes precedence over the scala-library used to run the current test.

  41. def printClassPath(implicit reporter: Reporter): Unit

    Attributes
    protected
    Definition Classes
    InteractiveTestSettings → PresentationCompilerInstance
  42. implicit val reporter: Reporter

    Attributes
    protected
    Definition Classes
    TestSettings
  43. def runDefaultTests(): Unit

    Run all defined PresentationCompilerTestDef

    Run all defined PresentationCompilerTestDef

    Attributes
    protected
  44. val runRandomTests: Boolean

    Attributes
    protected
  45. val settings: Settings

    Attributes
    protected
    Definition Classes
    PresentationCompilerInstance
  46. def shutdown(): Unit

    shutdown the presentation compiler.

    shutdown the presentation compiler.

    Attributes
    protected
  47. val sourceDir: String

    Where source files are placed.

    Where source files are placed.

    Attributes
    protected
    Definition Classes
    TestSettings
  48. lazy val sourceFiles: Array[SourceFile]

    collected source files that are to be used by the test runner

    collected source files that are to be used by the test runner

    Attributes
    protected
    Definition Classes
    TestResources
  49. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  50. val synchronousRequests: Boolean

    Should askAllSources wait for each ask to finish before issuing the next?

    Should askAllSources wait for each ask to finish before issuing the next?

    Attributes
    protected
    Definition Classes
    InteractiveTestPresentationCompilerRequestsWorkingMode
  51. lazy val testActions: ListBuffer[PresentationCompilerTestDef]

    The core set of test actions that are executed during each test run are CompletionAction, TypeAction and HyperlinkAction.

    The core set of test actions that are executed during each test run are CompletionAction, TypeAction and HyperlinkAction. Override this member if you need to change the default set of executed test actions.

    Attributes
    protected
  52. def toString(): String

    Definition Classes
    AnyRef → Any
  53. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  54. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  55. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  56. val withDocComments: Boolean

    Attributes
    protected
    Definition Classes
    PresentationCompilerInstance
  57. def [B](y: B): (InteractiveTest, B)

    Implicit information
    This member is added by an implicit conversion from InteractiveTest to ArrowAssoc[InteractiveTest] performed by method any2ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Shadowed Implicit Value Members

  1. val self: Any

    Implicit information
    This member is added by an implicit conversion from InteractiveTest to StringAdd performed by method any2stringadd in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (interactiveTest: StringAdd).self
    Definition Classes
    StringAdd
  2. val self: Any

    Implicit information
    This member is added by an implicit conversion from InteractiveTest to StringFormat performed by method any2stringfmt in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (interactiveTest: StringFormat).self
    Definition Classes
    StringFormat

Deprecated Value Members

  1. def x: InteractiveTest

    Implicit information
    This member is added by an implicit conversion from InteractiveTest to ArrowAssoc[InteractiveTest] performed by method any2ArrowAssoc in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (interactiveTest: ArrowAssoc[InteractiveTest]).x
    Definition Classes
    ArrowAssoc
    Annotations
    @deprecated
    Deprecated

    (Since version 2.10.0) Use leftOfArrow instead

  2. def x: InteractiveTest

    Implicit information
    This member is added by an implicit conversion from InteractiveTest to Ensuring[InteractiveTest] performed by method any2Ensuring in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (interactiveTest: Ensuring[InteractiveTest]).x
    Definition Classes
    Ensuring
    Annotations
    @deprecated
    Deprecated

    (Since version 2.10.0) Use resultOfEnsuring instead

Inherited from InteractiveTestSettings

Inherited from CoreTestDefs

Inherited from TestResources

Inherited from PresentationCompilerInstance

Inherited from TestSettings

Inherited from AskLoadedTyped

Inherited from AskReload

Inherited from AskShutdown

Inherited from AskParse

Inherited from AskCommand

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from InteractiveTest to StringAdd

Inherited by implicit conversion any2stringfmt from InteractiveTest to StringFormat

Inherited by implicit conversion any2ArrowAssoc from InteractiveTest to ArrowAssoc[InteractiveTest]

Inherited by implicit conversion any2Ensuring from InteractiveTest to Ensuring[InteractiveTest]

Ungrouped