package partest
- Alphabetic
- By Inheritance
- partest
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- sealed trait AsmNode[+T] extends AnyRef
- abstract class BytecodeTest extends AnyRef
Provides utilities for inspecting bytecode using ASM library.
Provides utilities for inspecting bytecode using ASM library.
HOW TO USE 1. Create subdirectory in test/files/jvm for your test. Let's name it $TESTDIR. 2. Create $TESTDIR/BytecodeSrc_1.scala that contains Scala source file that you want to inspect the bytecode for. The '_1' suffix signals to partest that it should compile this file first. 3. Create $TESTDIR/Test.scala: import scala.tools.partest.BytecodeTest object Test extends BytecodeTest { def show { // your code that inspect ASM trees and prints values } } 4. Create corresponding check file.
EXAMPLE See test/files/jvm/bytecode-test-example for an example of bytecode test.
- abstract class CompilerTest extends DirectTest
A DirectTest for testing compiler internals.
A DirectTest for testing compiler internals. The test must implement the
check
function to check the result of compiling thecode
; the test may overridesources
instead to check multiple sources.Each source code string in "sources" will be compiled, and the check function will be called with the source code and the resulting CompilationUnit. The check implementation should test for what it wants to test and fail (via assert or other exception) if it is not happy.
- class ConsoleLog extends AnyRef
- implicit final class Copier extends AnyVal
- abstract class DirectTest extends AnyRef
Test with code which is embedded as a string.
Test with code which is embedded as a string.
DirectTest
allows for more complete control over settings, compiler configuration, sequence of events, etc. than does partest alone.Tests must define
code
andshow()
. Minimally:def show() = assert(compile())
There are helper methods for creating settings and invoking a (newly constructed) compiler.
- type Directory = reflect.io.Directory
- implicit class ExecutorOps extends AnyRef
- type File = java.io.File
- implicit class FileOps extends AnyRef
- trait Hashless extends ReplTest
Strip Any.toString's id@abcdef16 hashCodes.
Strip Any.toString's id@abcdef16 hashCodes. These are generally at end of result lines.
- abstract class IcodeComparison extends DirectTest
A class for testing icode.
A class for testing icode. All you need is this in a partest source file --
object Test extends IcodeComparison
-- and the generated output will be the icode for everything in that file. See scaladoc for possible customizations. TODO promote me to partest
- abstract class IcodeTest extends DirectTest
A trait for testing icode.
A trait for testing icode. All you need is this in a partest source file:
object Test extends IcodeTest
And then the generated output will be the icode for everything in that file. See source for possible customizations.
- abstract class JUnitTest extends App
- abstract class JavapTest extends ReplTest
A trait for testing repl's javap command or possibly examining its output.
- trait Lambdaless extends ReplTest
Strip dynamic parts of LambdaMetafactory synthetic class names.
- implicit final class LoaderOps extends AnyVal
- abstract class MemoryTest extends AnyRef
- type Path = reflect.io.Path
- implicit class PathOps extends FileOps
- type PathResolver = util.PathResolver
- abstract class ReplTest extends DirectTest
Test code or commands in a REPL.
Test code or commands in a REPL.
Just call
show
to print the result ofeval()
yourcode
.Optionally,
transformSettings
or redefinenormalize
.The test filters the line of output that mentions a version number.
- type SFile = reflect.io.File
- abstract class ScaladocJavaModelTest extends ScaladocModelTest
A class for testing scaladoc model generation on java sources.
- abstract class ScaladocModelTest extends DirectTest
A class for testing scaladoc model generation
A class for testing scaladoc model generation
- you need to specify the code in the
code
method - you need to override the testModel method to test the model
- you may specify extra parameters to send to scaladoc in
scaladocSettings
import scala.tools.nsc.doc.model._ import scala.tools.partest.ScaladocModelTest object Test extends ScaladocModelTest { override def code = """ ... """ // or override def resourceFile = "<file>.scala" (from test/scaladoc/resources) def scaladocSettings = " ... " def testModel(rootPackage: Package) = { // get the quick access implicit defs in scope (_package(s), _class(es), _trait(s), object(s) _method(s), _value(s)) import access._ // just need to check the member exists, access methods will throw an error if there's a problem rootPackage._package("scala")._package("test")._class("C")._method("foo") } }
- you need to specify the code in the
- abstract class ScriptTest extends DirectTest
A
ScriptTest
is aDirectTest
for which the code is the contents of a script file. - abstract class SessionTest extends ReplTest
Run a REPL test from a session transcript.
Run a REPL test from a session transcript.
The
session
is read from the.check
file, and thecode
is the session stripped of output text.By default, output is compared against the check file as usual. Optionally, redefine
show
to usecheckSession()
, which compareseval()
result toexpected
.Redefine
session
if it must be constructed dynamically. Redefineshow
to usecheckSession
to postprocess theexpected
text and/or the result ofeval()
. - trait SigTest extends AnyRef
Support code for testing signatures.
- trait StackCleaner extends ReplTest
Normalize a REPL stack trace by stripping line numbers and count of elided frames.
- trait StoreReporterDirectTest extends DirectTest
- type StringWriter = java.io.StringWriter
- trait StubErrorMessageTest extends DirectTest with StoreReporterDirectTest
- class TestKinds extends AnyRef
- sealed abstract class TestState extends AnyRef
- class TestUnderJavaAtLeast[A] extends AnyRef
- implicit final class special string ops extends AnyVal
Value Members
- val ClassPath: nsc.util.ClassPath.type
- val Directory: reflect.io.Directory.type
- val EOL: String
- val Path: reflect.io.Path.type
- val PathResolver: util.PathResolver.type
- val SFile: File.type
- def allPropertiesString: String
- def basename(name: String): String
- def callable[T](body: => T): Callable[T]
- implicit val codec: Codec
- def debugSettings: String
- def elapsedString(millis: Long): String
- def fileSeparator: String
- def findProgram(name: String): Option[File]
- def ifJavaAtLeast[A](version: String)(yesRun: => A): TestUnderJavaAtLeast[A]
- def isDebug: Boolean
Debugger interest only below this line *
- def log(msg: => Any): Unit
- def nljoin(xs: String*): String
- def now: String
- def oempty(xs: String*): collection.immutable.Seq[String]
- def ojoin(xs: String*): String
- def onull(s: String): String
- def pathSeparator: String
- def setUncaughtHandler(): Unit
- val space: String
- implicit def stringPathToJavaFile(path: String): File
- implicit def temporaryPath2File(x: Path): File
- def timed[T](body: => T): (T, Long)
- def vmArgString: String
- object AsmNode
- object BytecodeTest
- object Hashless
- object Lambdaless
- object PartestDefaults
- object SessionTest
- object StackCleaner
- object TestState
- object Util