Skip to content

Commit dc6a7fd

Browse files
committed
Reduced test failures in ShouldContainElementSpec when built under Scala 2.13.0-M5.
1 parent d35f831 commit dc6a7fd

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

scalatest-test/src/test/scala/org/scalatest/ShouldContainElementSpec.scala

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -611,87 +611,87 @@ class ShouldContainElementSpec extends FunSpec with PropertyChecks with ReturnsN
611611
val caught = intercept[TestFailedException] {
612612
HashSet(1, 2) should contain (3)
613613
}
614-
assert(caught.getMessage === "Set(1, 2) did not contain element 3")
614+
assert(caught.getMessage === HashSet(1, 2) + " did not contain element 3")
615615
}
616616

617617
it("should throw TestFailedException if set contains the specified element, when used with not") {
618618

619619
val caught1 = intercept[TestFailedException] {
620620
HashSet(1, 2) should not contain (2)
621621
}
622-
assert(caught1.getMessage === "Set(1, 2) contained element 2")
622+
assert(caught1.getMessage === HashSet(1, 2) + " contained element 2")
623623

624624
val caught2 = intercept[TestFailedException] {
625625
HashSet(1, 2) should not (contain (2))
626626
}
627-
assert(caught2.getMessage === "Set(1, 2) contained element 2")
627+
assert(caught2.getMessage === HashSet(1, 2) + " contained element 2")
628628

629629
val caught3 = intercept[TestFailedException] {
630630
HashSet(1, 2) should (not contain (2))
631631
}
632-
assert(caught3.getMessage === "Set(1, 2) contained element 2")
632+
assert(caught3.getMessage === HashSet(1, 2) + " contained element 2")
633633
}
634634

635635
it("should throw a TestFailedException when set doesn't contain the specified element and used in a logical-and expression") {
636636

637637
val caught1 = intercept[TestFailedException] {
638638
HashSet(1, 2) should { contain (5) and (contain (2 - 1)) }
639639
}
640-
assert(caught1.getMessage === "Set(1, 2) did not contain element 5")
640+
assert(caught1.getMessage === HashSet(1, 2) + " did not contain element 5")
641641

642642
val caught2 = intercept[TestFailedException] {
643643
HashSet(1, 2) should (contain (5) and contain (2 - 1))
644644
}
645-
assert(caught2.getMessage === "Set(1, 2) did not contain element 5")
645+
assert(caught2.getMessage === HashSet(1, 2) + " did not contain element 5")
646646
}
647647

648648
it("should throw a TestFailedException when set doesn't contain the specified element and used in a logical-or expression") {
649649

650650
val caught1 = intercept[TestFailedException] {
651651
HashSet(1, 2) should { contain (55) or (contain (22)) }
652652
}
653-
assert(caught1.getMessage === "Set(1, 2) did not contain element 55, and Set(1, 2) did not contain element 22")
653+
assert(caught1.getMessage === HashSet(1, 2) + " did not contain element 55, and " + HashSet(1, 2) + " did not contain element 22")
654654

655655
val caught2 = intercept[TestFailedException] {
656656
HashSet(1, 2) should (contain (55) or contain (22))
657657
}
658-
assert(caught2.getMessage === "Set(1, 2) did not contain element 55, and Set(1, 2) did not contain element 22")
658+
assert(caught2.getMessage === HashSet(1, 2) + " did not contain element 55, and " + HashSet(1, 2) + " did not contain element 22")
659659
}
660660

661661
it("should throw a TestFailedException when set contains the specified element and used in a logical-and expression with not") {
662662

663663
val caught1 = intercept[TestFailedException] {
664664
HashSet(1, 2) should { not { contain (3) } and not { contain (2) }}
665665
}
666-
assert(caught1.getMessage === "Set(1, 2) did not contain element 3, but Set(1, 2) contained element 2")
666+
assert(caught1.getMessage === HashSet(1, 2) + " did not contain element 3, but " + HashSet(1, 2) + " contained element 2")
667667

668668
val caught2 = intercept[TestFailedException] {
669669
HashSet(1, 2) should ((not contain (3)) and (not contain (2)))
670670
}
671-
assert(caught2.getMessage === "Set(1, 2) did not contain element 3, but Set(1, 2) contained element 2")
671+
assert(caught2.getMessage === HashSet(1, 2) + " did not contain element 3, but " + HashSet(1, 2) + " contained element 2")
672672

673673
val caught3 = intercept[TestFailedException] {
674674
HashSet(1, 2) should (not contain (3) and not contain (2))
675675
}
676-
assert(caught3.getMessage === "Set(1, 2) did not contain element 3, but Set(1, 2) contained element 2")
676+
assert(caught3.getMessage === HashSet(1, 2) + " did not contain element 3, but " + HashSet(1, 2) + " contained element 2")
677677
}
678678

679679
it("should throw a TestFailedException when set contains the specified element and used in a logical-or expression with not") {
680680

681681
val caught1 = intercept[TestFailedException] {
682682
HashSet(1, 2) should { not { contain (2) } or not { contain (2) }}
683683
}
684-
assert(caught1.getMessage === "Set(1, 2) contained element 2, and Set(1, 2) contained element 2")
684+
assert(caught1.getMessage === HashSet(1, 2) + " contained element 2, and " + HashSet(1, 2) + " contained element 2")
685685

686686
val caught2 = intercept[TestFailedException] {
687687
HashSet(1, 2) should ((not contain (2)) or (not contain (2)))
688688
}
689-
assert(caught2.getMessage === "Set(1, 2) contained element 2, and Set(1, 2) contained element 2")
689+
assert(caught2.getMessage === HashSet(1, 2) + " contained element 2, and " + HashSet(1, 2) + " contained element 2")
690690

691691
val caught3 = intercept[TestFailedException] {
692692
HashSet(1, 2) should (not contain (2) or not contain (2))
693693
}
694-
assert(caught3.getMessage === "Set(1, 2) contained element 2, and Set(1, 2) contained element 2")
694+
assert(caught3.getMessage === HashSet(1, 2) + " contained element 2, and " + HashSet(1, 2) + " contained element 2")
695695
}
696696

697697
// SKIP-SCALATESTJS,NATIVE-START

0 commit comments

Comments
 (0)