Skip to content

Commit 973e4de

Browse files
committed
Enable tests in Scalactic for Dotty
As now assert supports .exists, .length, .size, .isInstanceOf, .isEmpty, we can enable the tests
1 parent bbc0975 commit 973e4de

File tree

2 files changed

+71
-23
lines changed

2 files changed

+71
-23
lines changed

scalactic-test/src/test/scala/org/scalactic/DirectRequirementsSpec.scala

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -878,8 +878,6 @@ class DirectRequirementsSpec extends FunSpec with OptionValues {
878878
org.scalactic.Requirements.require(s4.isEmpty)
879879
}
880880

881-
// SKIP-DOTTY-START
882-
// TODO: missing support for `.isEmpty`, `.length`, `.size`, `.exists`, `.isInstanceOf`
883881
it("should throw IllegalArgumentException with correct message and stack depth when is used to check s3.isEmpty") {
884882
val e = intercept[IllegalArgumentException] {
885883
org.scalactic.Requirements.require(s3.isEmpty)
@@ -979,12 +977,15 @@ class DirectRequirementsSpec extends FunSpec with OptionValues {
979977
org.scalactic.Requirements.require(l1.isInstanceOf[List[Int]])
980978
}
981979

980+
// SKIP-DOTTY-START
981+
// different printing of `List[Int]`
982982
it("should throw IllegalArgumentException with correct message and stack depth when is used to check s1.isInstanceOf[List[Int]]") {
983983
val e = intercept[IllegalArgumentException] {
984984
org.scalactic.Requirements.require(s1.isInstanceOf[List[Int]])
985985
}
986986
assert(e.getMessage == wasNotInstanceOf(s1, "scala.List"))
987987
}
988+
// SKIP-DOTTY-END
988989

989990
it("should do nothing when is used to check date.isInstanceOf[Date]") {
990991
org.scalactic.Requirements.require(date.isInstanceOf[Date])
@@ -1012,12 +1013,15 @@ class DirectRequirementsSpec extends FunSpec with OptionValues {
10121013
org.scalactic.Requirements.require(!s1.isInstanceOf[List[Int]])
10131014
}
10141015

1016+
// SKIP-DOTTY-START
1017+
// different printing of `List[Int]`
10151018
it("should throw IllegalArgumentException with correct message and stack depth when is used to check !l1.isInstanceOf[List[Int]]") {
10161019
val e = intercept[IllegalArgumentException] {
10171020
org.scalactic.Requirements.require(!l1.isInstanceOf[List[Int]])
10181021
}
10191022
assert(e.getMessage == wasInstanceOf(l1, "scala.List"))
10201023
}
1024+
// SKIP-DOTTY-END
10211025

10221026
it("should do nothing when is used to check !l1.isInstanceOf[Date]") {
10231027
org.scalactic.Requirements.require(!l1.isInstanceOf[Date])
@@ -1162,6 +1166,8 @@ class DirectRequirementsSpec extends FunSpec with OptionValues {
11621166
assert(e.getMessage == contained(l1, 3))
11631167
}
11641168

1169+
// SKIP-DOTTY-START
1170+
// different printing of anonymous functions
11651171
it("should throw IllegalArgumentException with correct message and stack depth when is used to check l1.exists(_ > 3)") {
11661172
val e = intercept[IllegalArgumentException] {
11671173
org.scalactic.Requirements.require(l1.exists(_ > 3))
@@ -1175,14 +1181,14 @@ class DirectRequirementsSpec extends FunSpec with OptionValues {
11751181
}
11761182
assert(e.getMessage == wasFalse("l3.exists(((x$7: String) => x$7.isEmpty()))"))
11771183
}
1184+
// SKIP-DOTTY-END
11781185

11791186
it("should throw IllegalArgumentException with correct message and stack depth when is used to check l3.exists(false)") {
11801187
val e = intercept[IllegalArgumentException] {
11811188
org.scalactic.Requirements.require(ci1.exists(321))
11821189
}
11831190
assert(e.getMessage == wasFalse("ci1.exists(321)"))
11841191
}
1185-
// SKIP-DOTTY-END
11861192

11871193
def woof(f: => Unit) = "woof"
11881194
def meow(x: Int = 0, y: Int = 3) = "meow"
@@ -2035,8 +2041,6 @@ class DirectRequirementsSpec extends FunSpec with OptionValues {
20352041
org.scalactic.Requirements.require(s4.isEmpty, ", dude")
20362042
}
20372043

2038-
// SKIP-DOTTY-START
2039-
// TODO: missing support for `.isEmpty`, `.length`, `.size`, `.exists`, `.isInstanceOf`
20402044
it("should throw IllegalArgumentException with correct message and stack depth when is used to check s3.isEmpty") {
20412045
val e = intercept[IllegalArgumentException] {
20422046
org.scalactic.Requirements.require(s3.isEmpty, ", dude")
@@ -2136,12 +2140,15 @@ class DirectRequirementsSpec extends FunSpec with OptionValues {
21362140
org.scalactic.Requirements.require(l1.isInstanceOf[List[Int]], ", dude")
21372141
}
21382142

2143+
// SKIP-DOTTY-START
2144+
// different printing of `List[Int]`
21392145
it("should throw IllegalArgumentException with correct message and stack depth when is used to check s1.isInstanceOf[List[Int]]") {
21402146
val e = intercept[IllegalArgumentException] {
21412147
org.scalactic.Requirements.require(s1.isInstanceOf[List[Int]], ", dude")
21422148
}
21432149
assert(e.getMessage == wasNotInstanceOf(s1, "scala.List") + ", dude")
21442150
}
2151+
// SKIP-DOTTY-END
21452152

21462153
it("should do nothing when is used to check date.isInstanceOf[Date]") {
21472154
org.scalactic.Requirements.require(date.isInstanceOf[Date], ", dude")
@@ -2169,12 +2176,15 @@ class DirectRequirementsSpec extends FunSpec with OptionValues {
21692176
org.scalactic.Requirements.require(!s1.isInstanceOf[List[Int]], ", dude")
21702177
}
21712178

2179+
// SKIP-DOTTY-START
2180+
// different printing of `List[Int]`
21722181
it("should throw IllegalArgumentException with correct message and stack depth when is used to check !l1.isInstanceOf[List[Int]]") {
21732182
val e = intercept[IllegalArgumentException] {
21742183
org.scalactic.Requirements.require(!l1.isInstanceOf[List[Int]], ", dude")
21752184
}
21762185
assert(e.getMessage == wasInstanceOf(l1, "scala.List") + ", dude")
21772186
}
2187+
// SKIP-DOTTY-END
21782188

21792189
it("should do nothing when is used to check !l1.isInstanceOf[Date]") {
21802190
org.scalactic.Requirements.require(!l1.isInstanceOf[Date], ", dude")
@@ -2319,6 +2329,8 @@ class DirectRequirementsSpec extends FunSpec with OptionValues {
23192329
assert(e.getMessage == contained(l1, 3) + ", dude")
23202330
}
23212331

2332+
// SKIP-DOTTY-START
2333+
// different printing of anonymous functions
23222334
it("should throw IllegalArgumentException with correct message and stack depth when is used to check l1.exists(_ > 3)") {
23232335
val e = intercept[IllegalArgumentException] {
23242336
org.scalactic.Requirements.require(l1.exists(_ > 3), ", dude")
@@ -3152,8 +3164,6 @@ class DirectRequirementsSpec extends FunSpec with OptionValues {
31523164
org.scalactic.Requirements.requireState(s4.isEmpty)
31533165
}
31543166

3155-
// SKIP-DOTTY-START
3156-
// TODO: missing support for `.isEmpty`, `.length`, `.size`, `.exists`, `.isInstanceOf`
31573167
it("should throw IllegalStateException with correct message and stack depth when is used to check s3.isEmpty") {
31583168
val e = intercept[IllegalStateException] {
31593169
org.scalactic.Requirements.requireState(s3.isEmpty)
@@ -3253,12 +3263,15 @@ class DirectRequirementsSpec extends FunSpec with OptionValues {
32533263
org.scalactic.Requirements.requireState(l1.isInstanceOf[List[Int]])
32543264
}
32553265

3266+
// SKIP-DOTTY-START
3267+
// different printing of `List[Int]`
32563268
it("should throw IllegalStateException with correct message and stack depth when is used to check s1.isInstanceOf[List[Int]]") {
32573269
val e = intercept[IllegalStateException] {
32583270
org.scalactic.Requirements.requireState(s1.isInstanceOf[List[Int]])
32593271
}
32603272
assert(e.getMessage == wasNotInstanceOf(s1, "scala.List"))
32613273
}
3274+
// SKIP-DOTTY-END
32623275

32633276
it("should do nothing when is used to check date.isInstanceOf[Date]") {
32643277
org.scalactic.Requirements.requireState(date.isInstanceOf[Date])
@@ -3286,12 +3299,15 @@ class DirectRequirementsSpec extends FunSpec with OptionValues {
32863299
org.scalactic.Requirements.requireState(!s1.isInstanceOf[List[Int]])
32873300
}
32883301

3302+
// SKIP-DOTTY-START
3303+
// different printing of `List[Int]`
32893304
it("should throw IllegalStateException with correct message and stack depth when is used to check !l1.isInstanceOf[List[Int]]") {
32903305
val e = intercept[IllegalStateException] {
32913306
org.scalactic.Requirements.requireState(!l1.isInstanceOf[List[Int]])
32923307
}
32933308
assert(e.getMessage == wasInstanceOf(l1, "scala.List"))
32943309
}
3310+
// SKIP-DOTTY-END
32953311

32963312
it("should do nothing when is used to check !l1.isInstanceOf[Date]") {
32973313
org.scalactic.Requirements.requireState(!l1.isInstanceOf[Date])
@@ -3436,6 +3452,8 @@ class DirectRequirementsSpec extends FunSpec with OptionValues {
34363452
assert(e.getMessage == contained(l1, 3))
34373453
}
34383454

3455+
// SKIP-DOTTY-START
3456+
// different printing of anonymous functions
34393457
it("should throw IllegalStateException with correct message and stack depth when is used to check l1.exists(_ > 3)") {
34403458
val e = intercept[IllegalStateException] {
34413459
org.scalactic.Requirements.requireState(l1.exists(_ > 3))
@@ -3449,14 +3467,14 @@ class DirectRequirementsSpec extends FunSpec with OptionValues {
34493467
}
34503468
assert(e.getMessage == wasFalse("l3.exists(((x$19: String) => x$19.isEmpty()))"))
34513469
}
3470+
// SKIP-DOTTY-END
34523471

34533472
it("should throw IllegalStateException with correct message and stack depth when is used to check l3.exists(false)") {
34543473
val e = intercept[IllegalStateException] {
34553474
org.scalactic.Requirements.requireState(ci1.exists(321))
34563475
}
34573476
assert(e.getMessage == wasFalse("ci1.exists(321)"))
34583477
}
3459-
// SKIP-DOTTY-END
34603478

34613479
def woof(f: => Unit) = "woof"
34623480
def meow(x: Int = 0, y: Int = 3) = "meow"
@@ -4309,8 +4327,6 @@ class DirectRequirementsSpec extends FunSpec with OptionValues {
43094327
org.scalactic.Requirements.requireState(s4.isEmpty, ", dude")
43104328
}
43114329

4312-
// SKIP-DOTTY-START
4313-
// TODO: missing support for `.isEmpty`, `.length`, `.size`, `.exists`, `.isInstanceOf`
43144330
it("should throw IllegalStateException with correct message and stack depth when is used to check s3.isEmpty") {
43154331
val e = intercept[IllegalStateException] {
43164332
org.scalactic.Requirements.requireState(s3.isEmpty, ", dude")
@@ -4410,12 +4426,15 @@ class DirectRequirementsSpec extends FunSpec with OptionValues {
44104426
org.scalactic.Requirements.requireState(l1.isInstanceOf[List[Int]], ", dude")
44114427
}
44124428

4429+
// SKIP-DOTTY-START
4430+
// different printing of `List[Int]`
44134431
it("should throw IllegalStateException with correct message and stack depth when is used to check s1.isInstanceOf[List[Int]]") {
44144432
val e = intercept[IllegalStateException] {
44154433
org.scalactic.Requirements.requireState(s1.isInstanceOf[List[Int]], ", dude")
44164434
}
44174435
assert(e.getMessage == wasNotInstanceOf(s1, "scala.List") + ", dude")
44184436
}
4437+
// SKIP-DOTTY-END
44194438

44204439
it("should do nothing when is used to check date.isInstanceOf[Date]") {
44214440
org.scalactic.Requirements.requireState(date.isInstanceOf[Date], ", dude")
@@ -4443,12 +4462,15 @@ class DirectRequirementsSpec extends FunSpec with OptionValues {
44434462
org.scalactic.Requirements.requireState(!s1.isInstanceOf[List[Int]], ", dude")
44444463
}
44454464

4465+
// SKIP-DOTTY-START
4466+
// different printing of `List[Int]`
44464467
it("should throw IllegalStateException with correct message and stack depth when is used to check !l1.isInstanceOf[List[Int]]") {
44474468
val e = intercept[IllegalStateException] {
44484469
org.scalactic.Requirements.requireState(!l1.isInstanceOf[List[Int]], ", dude")
44494470
}
44504471
assert(e.getMessage == wasInstanceOf(l1, "scala.List") + ", dude")
44514472
}
4473+
// SKIP-DOTTY-END
44524474

44534475
it("should do nothing when is used to check !l1.isInstanceOf[Date]") {
44544476
org.scalactic.Requirements.requireState(!l1.isInstanceOf[Date], ", dude")
@@ -4593,6 +4615,8 @@ class DirectRequirementsSpec extends FunSpec with OptionValues {
45934615
assert(e.getMessage == contained(l1, 3) + ", dude")
45944616
}
45954617

4618+
// SKIP-DOTTY-START
4619+
// different printing of anonymous functions
45964620
it("should throw IllegalStateException with correct message and stack depth when is used to check l1.exists(_ > 3)") {
45974621
val e = intercept[IllegalStateException] {
45984622
org.scalactic.Requirements.requireState(l1.exists(_ > 3), ", dude")
@@ -4606,14 +4630,14 @@ class DirectRequirementsSpec extends FunSpec with OptionValues {
46064630
}
46074631
assert(e.getMessage == wasFalse("l3.exists(((x$25: String) => x$25.isEmpty()))") + ", dude")
46084632
}
4633+
// SKIP-DOTTY-END
46094634

46104635
it("should throw IllegalStateException with correct message and stack depth when is used to check l3.exists(false)") {
46114636
val e = intercept[IllegalStateException] {
46124637
org.scalactic.Requirements.requireState(ci1.exists(321), ", dude")
46134638
}
46144639
assert(e.getMessage == wasFalse("ci1.exists(321)") + ", dude")
46154640
}
4616-
// SKIP-DOTTY-END
46174641

46184642
def woof(f: => Unit) = "woof"
46194643
def meow(x: Int = 0, y: Int = 3) = "meow"

0 commit comments

Comments
 (0)