p

scala.tools

partest

package partest

Source
package.scala
Linear Supertypes
Content Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. partest
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Package Members

  1. package async
  2. package instrumented
  3. package nest
  4. package sbt
  5. package utils

Type Members

  1. sealed trait AsmNode[+T] extends AnyRef
  2. 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.

  3. 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 the code; the test may override sources 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.

  4. class ConsoleLog extends AnyRef
  5. implicit final class Copier extends AnyVal
  6. 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 and show(). Minimally: def show() = assert(compile())

    There are helper methods for creating settings and invoking a (newly constructed) compiler.

  7. type Directory = reflect.io.Directory
  8. implicit class ExecutorOps extends AnyRef
  9. type File = java.io.File
  10. implicit class FileOps extends AnyRef
  11. 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.

  12. 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

  13. 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.

  14. abstract class JUnitTest extends App
  15. abstract class JavapTest extends ReplTest

    A trait for testing repl's javap command or possibly examining its output.

  16. trait Lambdaless extends ReplTest

    Strip dynamic parts of LambdaMetafactory synthetic class names.

  17. implicit final class LoaderOps extends AnyVal
  18. abstract class MemoryTest extends AnyRef
  19. type Path = reflect.io.Path
  20. implicit class PathOps extends FileOps
  21. type PathResolver = util.PathResolver
  22. 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 of eval() your code.

    Optionally, transformSettings or redefine normalize.

    The test filters the line of output that mentions a version number.

  23. type SFile = reflect.io.File
  24. abstract class ScaladocJavaModelTest extends ScaladocModelTest

    A class for testing scaladoc model generation on java sources.

  25. 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")
      }
    }
  26. abstract class ScriptTest extends DirectTest

    A ScriptTest is a DirectTest for which the code is the contents of a script file.

  27. 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 the code is the session stripped of output text.

    By default, output is compared against the check file as usual. Optionally, redefine show to use checkSession(), which compares eval() result to expected.

    Redefine session if it must be constructed dynamically. Redefine show to use checkSession to postprocess the expected text and/or the result of eval().

  28. trait SigTest extends AnyRef

    Support code for testing signatures.

  29. trait StackCleaner extends ReplTest

    Normalize a REPL stack trace by stripping line numbers and count of elided frames.

  30. trait StoreReporterDirectTest extends DirectTest
  31. type StringWriter = java.io.StringWriter
  32. trait StubErrorMessageTest extends DirectTest with StoreReporterDirectTest
  33. class TestKinds extends AnyRef
  34. sealed abstract class TestState extends AnyRef
  35. class TestUnderJavaAtLeast[A] extends AnyRef
  36. implicit final class special string ops extends AnyVal

Value Members

  1. val ClassPath: nsc.util.ClassPath.type
  2. val Directory: reflect.io.Directory.type
  3. val EOL: String
  4. val Path: reflect.io.Path.type
  5. val PathResolver: util.PathResolver.type
  6. val SFile: File.type
  7. def allPropertiesString: String
  8. def basename(name: String): String
  9. def callable[T](body: => T): Callable[T]
  10. implicit val codec: Codec
  11. def debugSettings: String
  12. def elapsedString(millis: Long): String
  13. def fileSeparator: String
  14. def findProgram(name: String): Option[File]
  15. def ifJavaAtLeast[A](version: String)(yesRun: => A): TestUnderJavaAtLeast[A]
  16. def isDebug: Boolean

    Debugger interest only below this line *

  17. def log(msg: => Any): Unit
  18. def nljoin(xs: String*): String
  19. def now: String
  20. def oempty(xs: String*): collection.immutable.Seq[String]
  21. def ojoin(xs: String*): String
  22. def onull(s: String): String
  23. def pathSeparator: String
  24. def setUncaughtHandler(): Unit
  25. val space: String
  26. implicit def stringPathToJavaFile(path: String): File
  27. implicit def temporaryPath2File(x: Path): File
  28. def timed[T](body: => T): (T, Long)
  29. def vmArgString: String
  30. object AsmNode
  31. object BytecodeTest
  32. object Hashless
  33. object Lambdaless
  34. object PartestDefaults
  35. object SessionTest
  36. object StackCleaner
  37. object TestState
  38. object Util

Inherited from AnyRef

Inherited from Any

Ungrouped