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
- Alphabetic
- By Inheritance
- InteractiveTest
- InteractiveTestSettings
- CoreTestDefs
- PresentationCompilerRequestsWorkingMode
- TestResources
- PresentationCompilerInstance
- TestSettings
- AskLoadedTyped
- AskReload
- AskShutdown
- AskParse
- AskCommand
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- All
Instance Constructors
- new InteractiveTest()
Type Members
-
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
-
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
-
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
-
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
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
def
+(other: String): String
- Implicit
- This member is added by an implicit conversion from InteractiveTest to any2stringadd[InteractiveTest] performed by method any2stringadd in scala.Predef.
- Definition Classes
- any2stringadd
-
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
-
def
->[B](y: B): (InteractiveTest, B)
- Implicit
- This member is added by an implicit conversion from InteractiveTest to ArrowAssoc[InteractiveTest] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @inline()
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
val
TIMEOUT: Int(30000)
- Attributes
- protected
- Definition Classes
- TestSettings
-
val
argsString: String
If there's a file ending in .opts, read it and parse it for cmd line arguments.
If there's a file ending in .opts, read it and parse it for cmd line arguments.
- Attributes
- protected
- Definition Classes
- InteractiveTestSettings
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
ask[T](op: (Response[T]) ⇒ Unit): Response[T]
Presentation compiler's
askXXX
actions work by doing side-effects on aResponse
instance passed as an argument during theaskXXX
call.Presentation compiler's
askXXX
actions work by doing side-effects on aResponse
instance passed as an argument during theaskXXX
call. The defined methodask
is meant to encapsulate this behavior.- Attributes
- protected
- Definition Classes
- AskCommand
-
def
askAllSources[T]: (TestMarker) ⇒ ((Position) ⇒ Response[T]) ⇒ ((Position, T) ⇒ Unit) ⇒ Unit
- Attributes
- protected
- Definition Classes
- PresentationCompilerRequestsWorkingMode
-
def
askLoadedTyped(source: SourceFile, keepLoaded: Boolean = false)(implicit reporter: Reporter): Response[Global.Tree]
- Attributes
- protected
- Definition Classes
- AskLoadedTyped
-
def
askParse(sources: Seq[SourceFile]): Unit
sources
need to be entirely parsed before running the test (else commands such asAskTypeCompletionAt
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 asAskTypeCompletionAt
may fail simply because the source's AST is not yet loaded).- Definition Classes
- AskParse
-
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
-
def
askShutdown(): Unit
- Definition Classes
- AskShutdown
-
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
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
lazy val
compiler: Global
- Attributes
- protected
- Definition Classes
- PresentationCompilerInstance
-
val
compilerReporter: Reporter
- Attributes
- protected
- Definition Classes
- PresentationCompilerInstance
-
def
createGlobal: Global
- Attributes
- protected
- Definition Classes
- PresentationCompilerInstance
-
def
ensuring(cond: (InteractiveTest) ⇒ Boolean, msg: ⇒ Any): InteractiveTest
- Implicit
- This member is added by an implicit conversion from InteractiveTest to Ensuring[InteractiveTest] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
ensuring(cond: (InteractiveTest) ⇒ Boolean): InteractiveTest
- Implicit
- This member is added by an implicit conversion from InteractiveTest to Ensuring[InteractiveTest] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
ensuring(cond: Boolean, msg: ⇒ Any): InteractiveTest
- Implicit
- This member is added by an implicit conversion from InteractiveTest to Ensuring[InteractiveTest] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
ensuring(cond: Boolean): InteractiveTest
- Implicit
- This member is added by an implicit conversion from InteractiveTest to Ensuring[InteractiveTest] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
execute(): Unit
- Attributes
- protected
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
formatted(fmtstr: String): String
- Implicit
- This member is added by an implicit conversion from InteractiveTest to StringFormat[InteractiveTest] performed by method StringFormat in scala.Predef.
- Definition Classes
- StringFormat
- Annotations
- @inline()
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
loadSources(): Unit
Load all sources before executing the test.
Load all sources before executing the test.
- Attributes
- protected
-
def
main(args: Array[String]): Unit
Test's entry point
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
normalize(s: String): String
- Attributes
- protected
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
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
-
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.
-
def
printClassPath(implicit reporter: Reporter): Unit
- Attributes
- protected
- Definition Classes
- InteractiveTestSettings → PresentationCompilerInstance
-
implicit
val
reporter: Reporter
- Attributes
- protected
- Definition Classes
- TestSettings
-
def
runDefaultTests(): Unit
Run all defined
PresentationCompilerTestDef
Run all defined
PresentationCompilerTestDef
- Attributes
- protected
-
val
runRandomTests: Boolean
- Attributes
- protected
-
val
settings: Settings
- Attributes
- protected
- Definition Classes
- PresentationCompilerInstance
-
val
sourceDir: String
Where source files are placed.
Where source files are placed.
- Attributes
- protected
- Definition Classes
- TestSettings
-
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
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
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
- InteractiveTest → PresentationCompilerRequestsWorkingMode
-
lazy val
testActions: ListBuffer[PresentationCompilerTestDef]
The core set of test actions that are executed during each test run are
CompletionAction
,TypeAction
andHyperlinkAction
.The core set of test actions that are executed during each test run are
CompletionAction
,TypeAction
andHyperlinkAction
. Override this member if you need to change the default set of executed test actions.- Attributes
- protected
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
→[B](y: B): (InteractiveTest, B)
- Implicit
- This member is added by an implicit conversion from InteractiveTest to ArrowAssoc[InteractiveTest] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
The Scala compiler and reflection APIs.