Skip to content
This repository was archived by the owner on Sep 8, 2022. It is now read-only.

Commit a24752a

Browse files
committed
Merge pull request #53 from scala/topic/sbt-partest-readme
Update README with new SBT instructions
2 parents 80e4315 + 834db6e commit a24752a

File tree

1 file changed

+34
-3
lines changed

1 file changed

+34
-3
lines changed

README.md

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ the compiler version that it's intended for.
2222
There are three ways of invoking partest:
2323

2424
- ant (see https://github.com/scala/scala/blob/2.11.x/test/build-partest.xml and https://github.com/scala/scala-partest/blob/master/src/main/scala/scala/tools/partest/PartestTask.scala)
25-
- sbt (http://github.com/scala/scala-partest-interface)
25+
- sbt (details below)
2626
- the [test/partest script](https://github.com/scala/scala/blob/2.11.x/test/partest), which uses ant to set up the classpath in the same way as the ant task, but then launches [ConsoleRunner](https://github.com/scala/scala-partest/blob/master/src/main/scala/scala/tools/partest/nest/ConsoleRunner.scala) directly.
2727

2828
The compiler to be tested must be on the classpath.
@@ -38,15 +38,46 @@ Here are some non-obvious useful options:
3838
- `-Dpartest.scalac_opts=...` -> add compiler options
3939
- `-Dpartest.debug=true` -> print debug messages
4040

41-
Advanced usage:
41+
## SBT usage
42+
43+
### Historical Note
44+
45+
These instructions are valid as of Partest 1.0.13. Prior to that release, SBT users required `sbt-partest-interface` in addition to `scala-partest`. The test framework class used to be `scala.tools.partest.Framework`, whereas now it is `scala.tools.partest.sbt.Framework`)
46+
47+
### Instructions
48+
49+
To sbt test your project with partest through this testing interface, add something like this to your build.sbt:
50+
51+
```
52+
libraryDependencies += "org.scala-lang.modules" %% "scala-partest" % "1.0.13" % "test" // or newer
53+
54+
fork in Test := true
55+
56+
javaOptions in Test += "-Xmx1G"
57+
58+
testFrameworks += new TestFramework("scala.tools.partest.sbt.Framework")
59+
60+
definedTests in Test += (
61+
new sbt.TestDefinition(
62+
"partest",
63+
// marker fingerprint since there are no test classes
64+
// to be discovered by sbt:
65+
new sbt.testing.AnnotatedFingerprint {
66+
def isModule = true
67+
def annotationName = "partest"
68+
}, true, Array())
69+
)
70+
```
71+
72+
## Advanced usage:
4273

4374
- tests may consist of multiple files (the test name is the directory's name),
4475
and files (including java sources) in that directory are compiled in order by looking
4576
at `_$N` suffixes before the file's extension and compiling them grouped by $N, in ascending order.
4677
- jars in `test/files/lib` are expected to be on the classpath and may be used by tests
4778
- certain kinds of tests (scalacheck/instrumented/specialized) add additional jars to the classpath
4879

49-
System properties available to tests:
80+
## System properties available to tests:
5081

5182
- `partest.output`: output directory (where classfiles go)
5283
- `partest.lib`: the path of the library (jar or class dir) being tested

0 commit comments

Comments
 (0)