Skip to content

Commit 9d39a88

Browse files
committed
Merge branch 'update-to-future-syntax' of https://github.com/dotty-staging/scalatest into dotty-fix-20190731
2 parents 40b8ca0 + 8b84346 commit 9d39a88

30 files changed

+53
-54
lines changed

common-test/src/main/scala/org/scalatest/prop/CommonGenerators.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2403,7 +2403,7 @@ trait CommonGenerators {
24032403
// classify will need to use the same sizing algo as forAll, and same edges approach
24042404
def classify[A](count: PosInt, genOfA: Generator[A])(pf: PartialFunction[A, String]): Classification = {
24052405

2406-
val (initEdges, rnd1) = genOfA.initEdges(100, Randomizer.default())
2406+
val (initEdges, rnd1) = genOfA.initEdges(100, Randomizer.default)
24072407
@tailrec
24082408
def loop(currentCount: Int, edges: List[A], rnd: Randomizer, acc: Map[String, PosZInt]): Map[String, PosZInt] = {
24092409
if (currentCount >= count) acc

common-test/src/main/scala/org/scalatest/prop/Randomizer.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2204,7 +2204,7 @@ object Randomizer {
22042204
/**
22052205
* This seed is empty under ordinary circumstances. It is here so that the test
22062206
* Runner can poke in a seed value to be used during a test run. If set, it will be used
2207-
* as the seed for all calls to [[Randomizer.default()]].
2207+
* as the seed for all calls to [[Randomizer.default]].
22082208
*/
22092209
private[scalatest] val defaultSeed: AtomicReference[Option[Long]] = new AtomicReference(None)
22102210

@@ -2216,7 +2216,7 @@ object Randomizer {
22162216
*
22172217
* @return A Randomizer, ready to begin producing random values.
22182218
*/
2219-
def default(): Randomizer =
2219+
def default: Randomizer =
22202220
apply(
22212221
defaultSeed.get() match {
22222222
case Some(seed) => seed
@@ -2236,7 +2236,7 @@ object Randomizer {
22362236
* your "random" events.
22372237
*
22382238
* If you want to create an adequate seed to feed into here, the value of [[System.currentTimeMillis()]] is
2239-
* reasonable (and is used in [[Randomizer.default()]]). It's a somewhat weak seed, but decent for most
2239+
* reasonable (and is used in [[Randomizer.default]]). It's a somewhat weak seed, but decent for most
22402240
* purposes.
22412241
*
22422242
* @param seed A number that will be used to initialize a new Randomizer.
@@ -2267,7 +2267,7 @@ object Randomizer {
22672267
val buf = ArrayBuffer.empty[T]
22682268
buf ++= xs
22692269

2270-
def swap(i: Int, j: Int) {
2270+
def swap(i: Int, j: Int): Unit = {
22712271
val tmp = buf(i)
22722272
buf(i) = buf(j)
22732273
buf(j) = tmp

project/GenMatchers.scala

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,6 @@ object GenMatchers {
156156
shouldDir.mkdirs()
157157
val mustDir = new File(matchersDir, "must")
158158
mustDir.mkdirs()
159-
160-
(if (scalaJS || dotty)
161-
Seq(translateFile(shouldDir, "Matchers.scala", "scalatest/src/main/scala/org/scalatest/matchers/should/Matchers.scala", scalaVersion, scalaJS, dotty, line => line))
162-
else
163-
Seq.empty[File]) ++
164159
Seq(
165160
translateFile(mustDir, "Matchers.scala", "scalatest/src/main/scala/org/scalatest/matchers/should/Matchers.scala", scalaVersion, scalaJS, dotty, translateShouldToMust)
166161
/*translateFile(targetDir, "WillMatchers.scala", "scalatest/src/main/scala/org/scalatest/Matchers.scala", scalaVersion, scalaJS, translateShouldToWill)

project/GenResources.scala

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,16 @@ trait GenResourcesJVM extends GenResources {
158158
if (paramCount > 0)
159159
"def " + kv.key + "(" + (for (i <- 0 until paramCount) yield s"param$i: Any").mkString(", ") + "): String = makeString(\"" + kv.key + "\", Array(" + (for (i <- 0 until paramCount) yield s"param$i").mkString(", ") + "))"
160160
else
161-
"def " + kv.key + "(): String = resourceBundle.getString(\"" + kv.key + "\")"
161+
"def " + kv.key + ": String = resourceBundle.getString(\"" + kv.key + "\")"
162162
) + "\n\n" +
163163
"def raw" + kv.key.capitalize + ": String = resourceBundle.getString(\"" + kv.key + "\")"
164164

165-
def failureMessagesKeyValueTemplate(kv: KeyValue, paramCount: Int): String =
166-
"def " + kv.key + (if (paramCount == 0) "(" else "(prettifier: org.scalactic.Prettifier, ") + (for (i <- 0 until paramCount) yield s"param$i: Any").mkString(", ") + "): String = Resources." + kv.key + "(" + (for (i <- 0 until paramCount) yield s"prettifier.apply(param$i)").mkString(", ") + ")"
165+
def failureMessagesKeyValueTemplate(kv: KeyValue, paramCount: Int): String = {
166+
if (paramCount == 0)
167+
"def " + kv.key + ": String = Resources." + kv.key
168+
else
169+
"def " + kv.key + "(prettifier: org.scalactic.Prettifier, " + (for (i <- 0 until paramCount) yield s"param$i: Any").mkString(", ") + "): String = Resources." + kv.key + "(" + (for (i <- 0 until paramCount) yield s"prettifier.apply(param$i)").mkString(", ") + ")"
170+
}
167171

168172
}
169173

scalactic.dotty/src/main/scala/org/scalactic/source/Position.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ object Position {
7171

7272
val file = rootPosition.sourceFile
7373
val fileName: String = file.jpath.getFileName.toString
74-
val filePath: String = if (showScalacticFillFilePathnames) file.toString else Resources.pleaseDefineScalacticFillFilePathnameEnvVar()
74+
val filePath: String = if (showScalacticFillFilePathnames) file.toString else Resources.pleaseDefineScalacticFillFilePathnameEnvVar
7575
val lineNo: Int = rootPosition.startLine
7676
'{ Position(${fileName.toExpr}, ${filePath.toExpr}, ${lineNo.toExpr}) }
7777
}

scalatest-test/src/test/scala/org/scalatest/prop/GeneratorSpec.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,11 @@ class GeneratorSpec extends FunSpec with Matchers {
9898
it("should offer a filter method that throws an exception if too many objects are filtered out") {
9999
val doNotDoThisAtHome = CommonGenerators.ints.filter(i => i == 0) // Only keep zero
100100
a [IllegalStateException] should be thrownBy {
101-
doNotDoThisAtHome.next(SizeParam(PosZInt(0), 100, 100), Nil, Randomizer.default())
101+
doNotDoThisAtHome.next(SizeParam(PosZInt(0), 100, 100), Nil, Randomizer.default)
102102
}
103103
val okToDoThisAtHome = CommonGenerators.ints.filter(i => i != 0) // Only keep non-zeros
104104
noException should be thrownBy {
105-
okToDoThisAtHome.next(SizeParam(PosZInt(0), 100, 100), Nil, Randomizer.default())
105+
okToDoThisAtHome.next(SizeParam(PosZInt(0), 100, 100), Nil, Randomizer.default)
106106
}
107107
}
108108
it("should mix up both i and d when used in a for expression") {
@@ -2808,7 +2808,7 @@ class GeneratorSpec extends FunSpec with Matchers {
28082808
it("should offer a tuple2 generator") {
28092809
val gen = implicitly[Generator[(Int, Int)]]
28102810
val intGen = implicitly[Generator[Int]]
2811-
val (it8, rnd1) = intGen.shrink(8, Randomizer.default())
2811+
val (it8, rnd1) = intGen.shrink(8, Randomizer.default)
28122812
val (it18, rnd2)= intGen.shrink(18, rnd1)
28132813
val list8 = it8.toList
28142814
val list18 = it18.toList
@@ -2823,7 +2823,7 @@ class GeneratorSpec extends FunSpec with Matchers {
28232823
val tupGen: Generator[(String, Int)] = Generator.tuple2Generator[String, Int]
28242824
case class Person(name: String, age: Int)
28252825
val persons = for (tup <- tupGen) yield Person(tup._1, tup._2)
2826-
val (it, _) = persons.shrink(Person("Harry Potter", 32), Randomizer.default())
2826+
val (it, _) = persons.shrink(Person("Harry Potter", 32), Randomizer.default)
28272827
it.toList should not be empty
28282828
}
28292829
}

scalatest/src/main/scala/org/scalatest/AsyncTestRegistration.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ trait AsyncTestRegistration { theSuite: AsyncTestSuite =>
3131
* @param testTags the test tags
3232
* @param testFun the test function
3333
*/
34-
def registerAsyncTest(testText: String, testTags: Tag*)(testFun: => Future[compatible.Assertion])(implicit pos: source.Position)
34+
def registerAsyncTest(testText: String, testTags: Tag*)(testFun: => Future[compatible.Assertion])(implicit pos: source.Position): Unit
3535

3636
/**
3737
* Registers an ignored test.
@@ -40,5 +40,5 @@ trait AsyncTestRegistration { theSuite: AsyncTestSuite =>
4040
* @param testTags the test tags
4141
* @param testFun the test function
4242
*/
43-
def registerIgnoredAsyncTest(testText: String, testTags: Tag*)(testFun: => Future[compatible.Assertion])(implicit pos: source.Position)
43+
def registerIgnoredAsyncTest(testText: String, testTags: Tag*)(testFun: => Future[compatible.Assertion])(implicit pos: source.Position): Unit
4444
}

scalatest/src/main/scala/org/scalatest/DistributedSuiteSorter.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ trait DistributedSuiteSorter {
3434
*
3535
* @param suiteId the <code>suiteId</code> for the suite that's starting to execute its tests
3636
*/
37-
def distributingTests(suiteId: String)
37+
def distributingTests(suiteId: String): Unit
3838

3939
/**
4040
* This method is called after all tests in the suite completed execution
4141
*
4242
* @param suiteId the <code>suiteId</code> for the suite that's completed its tests execution
4343
*/
44-
def completedTests(suiteId: String)
44+
def completedTests(suiteId: String): Unit
4545
}

scalatest/src/main/scala/org/scalatest/DistributedTestSorter.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ trait DistributedTestSorter {
4444
*
4545
* @param testName the name of the test that has completed
4646
*/
47-
def distributingTest(testName: String)
47+
def distributingTest(testName: String): Unit
4848

4949
/**
5050
* Report an event for a distributed test.
@@ -53,7 +53,7 @@ trait DistributedTestSorter {
5353
* @param event the event to report
5454
* @throws NullArgumentException if either <code>testName</code> or <code>event</code> is null.
5555
*/
56-
def apply(testName: String, event: Event)
56+
def apply(testName: String, event: Event): Unit
5757

5858
/**
5959
* Indicates the events for the distributed test with the specified name have all been fired.
@@ -65,5 +65,5 @@ trait DistributedTestSorter {
6565
*
6666
* @param testName the name of the test that has completed
6767
*/
68-
def completedTest(testName: String)
68+
def completedTest(testName: String): Unit
6969
}

scalatest/src/main/scala/org/scalatest/Fact.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ private[scalatest] sealed abstract class Fact {
6666
*
6767
* @return a simplified version of this Fact
6868
*/
69-
def unary_!(): Fact = Fact.Unary_!(this)
69+
def unary_! : Fact = Fact.Unary_!(this)
7070

7171
final def ||(rhs: => Fact): Fact = if (isYes) this else Fact.Binary_||(this, rhs)
7272

@@ -846,7 +846,7 @@ private[scalatest] object Fact {
846846
val isYes: Boolean = !(underlying.isYes)
847847
val isVacuousYes: Boolean = false
848848

849-
override def unary_!(): org.scalatest.Fact = underlying
849+
override def unary_! : org.scalatest.Fact = underlying
850850

851851
override def factDiagram(level: Int): String = {
852852
val padding = " " * level

0 commit comments

Comments
 (0)