All positions of the given string in all source files.
If there's a file ending in .
If there's a file ending in .opts, read it and parse it for cmd line arguments.
Perform an operation on all sources at all positions that match the given marker string.
Perform an operation on all sources at all positions that match the given marker string. For instance, askAllSources("/*!*/)(askTypeAt)(println) would ask the tyep at all positions marked with /*!*/and println the result.
Synchronous version of askAllSources.
Synchronous version of askAllSources. Each position is treated in turn, waiting for the response before going to the next one.
The base directory for this test, usually a subdirectory of "test/files/presentation/"
Ask completion for all marked positions in all sources.
Ask completion for all marked positions in all sources. A completion position is marked with /*!*/
The root directory for this test suite, usually the test kind ("test/files/presentation").
Return all positions of the given str in the given source file.
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.
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.
Perform n random tests with random changes.
Reload the given source files and wait for them to be reloaded.
Return the filename:line:col version of this position.
Where source files are placed.
All .
All .scala files below "src" directory.
Should askAllSources wait for each ask to finish before issueing the next?
Ask for typedAt for all marker positions in all sources.
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 classes found under
src/
. They are found insourceFiles
. Positions can be created usingpos(file, line, col)
. The presentation compiler is available throughcompiler
.It is easy to test member completion and type at a given position. Source files are searched for /markers/. By default, the completion marker is
/*!*/ and the typedAt marker is
/*?*/. Place these markers in your source files, and callcompletionTests
andtypedAtTests
to print the results at all these positions. Sources are reloaded byreloadSources
(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 timout is 5 seconds per operation.The same mechanism can be used for custom operations. Use
askAllSources(marker)(f)(g)
. Give your custom marker, and provide the two functions: one for creating the request, and the second for processing the response, if it didn't time out and there was no error.Check existing tests under test/files/presentation