scalafix.testkit

Members list

Type members

Classlikes

abstract class AbstractSemanticRuleSuite(val props: TestkitProperties, val isSaveExpect: Boolean) extends Suite, TestRegistration, DiffAssertions, BeforeAndAfterAll

Construct a test suite for running semantic Scalafix rules.

Construct a test suite for running semantic Scalafix rules.

Mix-in AnyFunSuiteLike or the testing style of your choice if you add your own tests.

Attributes

Supertypes
trait BeforeAndAfterAll
trait SuiteMixin
trait TestRegistration
trait Suite
trait Serializable
trait Assertions
trait TripleEquals
trait TripleEqualsSupport
class Object
trait Matchable
class Any
Show all
Self type
abstract class AbstractSyntacticRuleSuite() extends Suite, TestRegistration, DiffAssertions

Utility to unit test syntactic rules.

Utility to unit test syntactic rules.

Mix-in AnyFunSuiteLike or the testing style of your choice if you add your own tests.

Value parameters

rule

the default rule to use from check/checkDiff.

Attributes

Supertypes
trait TestRegistration
trait Suite
trait Serializable
trait Assertions
trait TripleEquals
trait TripleEqualsSupport
class Object
trait Matchable
class Any
Show all

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
trait DiffAssertions extends Suite

Attributes

Companion
object
Supertypes
trait Suite
trait Serializable
trait Assertions
trait TripleEquals
trait TripleEqualsSupport
class Object
trait Matchable
class Any
Show all
Known subtypes
final class RuleTest(val path: TestkitPath, val run: () => (Rules, SemanticDocument))

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object RuleTest

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
RuleTest.type

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
final class TestkitPath(val input: AbsolutePath, val testPath: RelativePath, val semanticdbPath: RelativePath)

An input file for a testkit test.

An input file for a testkit test.

Value parameters

input

the absolute path to the input file.

semanticdbPath

the input file relativized by the SemanticDB sourceroot. Used to compute the path to the SemanticDB payload.

testPath

the input file relativized by input source directory (but including its last subpath). Used to compute the test name and the expected output file.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object TestkitPath

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
final class TestkitProperties(val inputClasspath: Classpath, val inputSourceDirectories: List[AbsolutePath], val outputSourceDirectories: List[AbsolutePath], val sourceroot: AbsolutePath, val scalaVersion: String, val scalacOptions: List[String])

Input arguments to run scalafix testkit rules.

Input arguments to run scalafix testkit rules.

By convention, it's possible to load a TestkitProperties instance from the resource file "scalafix-testkit.properties".

Value parameters

inputClasspath

The class directory of the input sources. This directory should contain a META-INF/semanticd sub-directory with SemanticDB files.

inputSourceDirectories

The source directory of the input sources. This directory should contain Scala code to be fixed by Scalafix.

outputSourceDirectories

The source directories of the expected output sources. These directories should contain Scala source files with the expected output after running Scalafix. When multiple directories are provided, the first directory that contains a source files with a matching relative path in inputSourceroot is used.

scalaVersion

The Scala compiler version used to compile the input sources. This information is passed to rules through the withConfiguration method.

scalacOptions

The Scala compiler options used to compile the input sources. This information is passed to rules through the withConfiguration method.

sourceroot

The SemanticDB sourceroot used to compile the input sources. Defaults to current working directory. Must match the value of -P:semanticdb:sourceroot:>value<, if any.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type