package tests
- Alphabetic
- Public
- All
Type Members
-
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.
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 insourceFiles
. traitTestResources
The presentation compiler is available throughcompiler
.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 byaskReload(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 extendingPresentationCompilerTestDef
(3) Add the class defined in (1) to the set of executed test actions by calling++
onInteractiveTest
.Then you can simply use the new defined
marker
in your test sources and the testing framework will automatically pick it up.- See also
Check existing tests under test/files/presentation
- trait InteractiveTestSettings extends TestSettings with PresentationCompilerInstance
- class Tester extends AnyRef
The Scala compiler and reflection APIs.