Packages

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
Source
InteractiveTest.scala
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
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 StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new InteractiveTest()

Type Members

  1. class HyperlinkAction extends PresentationCompilerTestDef with AskTypeAt with AskTypeCompletionAt

    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
  2. class ScopeCompletionAction extends PresentationCompilerTestDef with AskScopeCompletionAt

    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
  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
  4. class TypeCompletionAction extends PresentationCompilerTestDef with AskTypeCompletionAt

    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

Value Members

  1. def askParse(sources: Seq[SourceFile]): Unit

    sources need to be entirely parsed before running the test (else commands such as AskTypeCompletionAt 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 AskTypeCompletionAt may fail simply because the source's AST is not yet loaded).

    Definition Classes
    AskParse
  2. def askShutdown(): Unit
    Definition Classes
    AskShutdown
  3. def main(args: Array[String]): Unit

    Test's entry point