Skip to content

Commit 5959191

Browse files
committed
Merge branch 'cheeseng-cs-feature-insertion-order-set' into feature-insertion-order-set
2 parents 99bfbef + c0b86c8 commit 5959191

38 files changed

+66
-44
lines changed

project/GenScalaTestJS.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,8 @@ object GenScalaTestJS {
263263
"StreamlinedXmlEqualitySpec.scala", // skipped because use scala.xml
264264
"StreamlinedXmlNormMethodsSpec.scala", // skipped because use scala.xml
265265
"StreamlinedXmlSpec.scala", // skipped because use scala.xml
266-
"SuiteSuite.scala" // skipped because it depends on java reflection
266+
"SuiteSuite.scala", // skipped because it depends on java reflection
267+
"MatchersSerializableSpec.scala" // skipped because testing java serialization
267268
)) ++
268269
copyDir("scalatest-test/src/test/scala/org/scalatest/concurrent", "org/scalatest/concurrent", targetDir,
269270
List(

project/plugins.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8.3")
22

33
addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.7.0")
44

5-
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.9")
5+
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.10")

project/scalatest.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ object ScalatestBuild extends Build {
184184

185185
def scalatestJSLibraryDependencies =
186186
Seq(
187-
"org.scala-js" %% "scalajs-test-interface" % "0.6.9"
187+
"org.scala-js" %% "scalajs-test-interface" % "0.6.10"
188188
)
189189

190190
def scalatestTestOptions =
@@ -626,9 +626,9 @@ object ScalatestBuild extends Build {
626626
}.taskValue
627627
},
628628
sourceGenerators in Test <+=
629-
(baseDirectory, sourceManaged in Test, version, scalaVersion) map genFiles("gengen", "GenGen.scala")(GenGen.genTest),
629+
(baseDirectory, sourceManaged in Test, version, scalaVersion) map genFiles("gengen", "GenGen.scala")(GenGen.genTest)/*,
630630
sourceGenerators in Test <+=
631-
(baseDirectory, sourceManaged in Test, version, scalaVersion) map genFiles("genmatchers", "GenMustMatchersTests.scala")(GenMustMatchersTests.genTestForScalaJS)
631+
(baseDirectory, sourceManaged in Test, version, scalaVersion) map genFiles("genmatchers", "GenMustMatchersTests.scala")(GenMustMatchersTests.genTestForScalaJS)*/
632632
).dependsOn(scalatestJS % "test", commonTestJS % "test").enablePlugins(ScalaJSPlugin)
633633

634634
lazy val scalatestApp = Project("scalatestApp", file("."))

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

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,34 @@ package org.scalatest
1818
class InsertionOrderSetSpec extends FunSpec with Matchers {
1919
describe("An InsertionOrderSet") {
2020
it("should offer an apply method in the companion object") {
21-
InsertionOrderSet(List(1, 2, 3)) shouldEqual (new InsertionOrderSet(List(1, 2, 3)))
21+
InsertionOrderSet(List(1, 2, 3)) shouldBe (InsertionOrderSet(List(1, 2, 3)))
2222
}
2323
it("should ensure duplicates can't be passed to the constructor") {
24-
InsertionOrderSet(List(1, 2, 3, 3)) shouldEqual InsertionOrderSet(List(1, 2, 3))
24+
InsertionOrderSet(List(1, 2, 3, 3)) shouldBe InsertionOrderSet(List(1, 2, 3))
2525
}
2626
it("should ensure duplicates can't be added") {
27-
InsertionOrderSet(List(1, 2, 3)) + 3 shouldEqual InsertionOrderSet(List(1, 2, 3))
27+
InsertionOrderSet(List(1, 2, 3)) + 3 shouldBe InsertionOrderSet(List(1, 2, 3))
2828
}
2929
it("should ensure non-duplicates can be added") {
30-
InsertionOrderSet(List(1, 2, 3)) + 4 shouldEqual InsertionOrderSet(List(1, 2, 3, 4))
30+
InsertionOrderSet(List(1, 2, 3)) + 4 shouldBe InsertionOrderSet(List(1, 2, 3, 4))
31+
}
32+
it("should return Iterator that iterates elements in the order they were inserted") {
33+
val set = InsertionOrderSet(List(2, 1, 3))
34+
val itr = set.iterator
35+
itr.next shouldBe 2
36+
itr.next shouldBe 1
37+
itr.next shouldBe 3
38+
}
39+
it("should return true when contains is called with element it contains") {
40+
val set = InsertionOrderSet(List(2, 1, 3))
41+
set.contains(1) shouldBe true
42+
}
43+
it("should return false when contains is called with element it contains") {
44+
val set = InsertionOrderSet(List(2, 1, 3))
45+
set.contains(6) shouldBe false
46+
}
47+
it("should remove element passed in from -") {
48+
InsertionOrderSet(List(2, 1, 3)) - 1 shouldBe InsertionOrderSet(List(2, 3))
3149
}
3250
}
3351
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,12 +217,15 @@ class ShouldBeAnySpec extends FunSpec with Checkers with ReturnsNormallyThrowsAs
217217
}
218218
assert(e.message == Some("!!! test [1] !!! was not equal to !!! test [2] !!!"))
219219
}
220+
221+
// SKIP-SCALATESTJS-START
220222
it("should produce TestFailedExceptions that can be serialized") {
221223
import scala.util.Try
222224
val result = Try(1 shouldBe 2)
223225
val baos = new java.io.ByteArrayOutputStream
224226
val oos = new java.io.ObjectOutputStream(baos)
225227
oos.writeObject(result) // Should not throw an exeption
226228
}
229+
// SKIP-SCALATESTJS-END
227230
}
228231
}

scalatest/src/main/scala/org/scalatest/AsyncEngine.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ private[scalatest] sealed abstract class AsyncSuperEngine[T](concurrentBundleMod
751751

752752
val testLeaf = TestLeaf(currentBranch, testName, testText, testFun, testLocation, Some(pos), duration)
753753
testsMap += (testName -> testLeaf)
754-
testNamesList ::= testName
754+
testNamesList = testNamesList :+ testName
755755
currentBranch.subNodes ::= testLeaf
756756

757757
val tagNames = Set[String]() ++ testTags.map(_.name)

scalatest/src/main/scala/org/scalatest/AsyncFeatureSpecLike.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ trait AsyncFeatureSpecLike extends AsyncTestSuite with AsyncTestRegistration wit
314314
*/
315315
// override def testNames: Set[String] = ListSet(atomic.get.testsList.map(_.testName): _*)
316316
override def testNames: Set[String] = {
317-
new InsertionOrderSet(atomic.get.testNamesList)
317+
InsertionOrderSet(atomic.get.testNamesList)
318318
}
319319

320320
override def run(testName: Option[String], args: Args): Status = {

scalatest/src/main/scala/org/scalatest/AsyncFlatSpecLike.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1804,7 +1804,7 @@ import resultOfStringPassedToVerb.verb
18041804
* </pre>
18051805
*/
18061806
override def testNames: Set[String] = {
1807-
new InsertionOrderSet(atomic.get.testNamesList)
1807+
InsertionOrderSet(atomic.get.testNamesList)
18081808
}
18091809

18101810
override def run(testName: Option[String], args: Args): Status = {

scalatest/src/main/scala/org/scalatest/AsyncFreeSpecLike.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ trait AsyncFreeSpecLike extends AsyncTestSuite with AsyncTestRegistration with I
515515
* </pre>
516516
*/
517517
override def testNames: Set[String] = {
518-
new InsertionOrderSet(atomic.get.testNamesList)
518+
InsertionOrderSet(atomic.get.testNamesList)
519519
}
520520

521521
override def run(testName: Option[String], args: Args): Status = {

scalatest/src/main/scala/org/scalatest/AsyncFunSpecLike.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ trait AsyncFunSpecLike extends AsyncTestSuite with AsyncTestRegistration with In
403403
*/
404404
override def testNames: Set[String] = {
405405
// I'm returning a ListSet here so that they tests will be run in registration order
406-
new InsertionOrderSet(atomic.get.testNamesList)
406+
InsertionOrderSet(atomic.get.testNamesList)
407407
}
408408

409409
/**

0 commit comments

Comments
 (0)