Skip to content

Commit

Permalink
Changed GenTraversable to Iterable in NonEmptyXXXSpec.scala.
Browse files Browse the repository at this point in the history
  • Loading branch information
cheeseng committed Oct 18, 2023
1 parent 7d5a0e7 commit 632948c
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package org.scalactic.anyvals

import scala.collection.GenTraversable
import org.scalactic.ColCompatHelper.Iterable
import scala.collection.mutable.Buffer
import scala.collection.mutable.ListBuffer

Expand All @@ -42,7 +42,7 @@ class NonEmptyListSpec extends UnitSpec {
threesie(1) shouldBe 2
threesie(2) shouldBe 3
}
it can "be constructed from a GenTraversable via the from method on NonEmptyList singleton" in {
it can "be constructed from a Iterable via the from method on NonEmptyList singleton" in {
NonEmptyList.from(List.empty[String]) shouldBe None
NonEmptyList.from(List("1")) shouldBe Some(NonEmptyList("1"))
NonEmptyList.from(List(1, 2, 3)) shouldBe Some(NonEmptyList(1, 2, 3))
Expand Down Expand Up @@ -165,10 +165,10 @@ class NonEmptyListSpec extends UnitSpec {
NonEmptyList(1, 2, 3) ++ Every(4) shouldEqual NonEmptyList(1, 2, 3, 4)
NonEmptyList(1, 2, 3) ++ One(4) shouldEqual NonEmptyList(1, 2, 3, 4)
}
it should "have a ++ method that takes a GenTraversableOnce" in {
it should "have a ++ method that takes a IterableOnce" in {
NonEmptyList(1, 2, 3) ++ List(4) shouldEqual NonEmptyList(1, 2, 3, 4)
NonEmptyList(1, 2, 3) ++ Vector(4, 5, 6) shouldEqual NonEmptyList(1, 2, 3, 4, 5, 6)
NonEmptyList(1, 2, 3) ++ GenTraversable(4) shouldEqual NonEmptyList(1, 2, 3, 4)
NonEmptyList(1, 2, 3) ++ Iterable(4) shouldEqual NonEmptyList(1, 2, 3, 4)
NonEmptyList(1, 2, 3) ++ Set(4, 5) shouldEqual NonEmptyList(1, 2, 3, 4, 5)
NonEmptyList(1, 2, 3) ++ Set(4, 5).iterator shouldEqual NonEmptyList(1, 2, 3, 4, 5)
}
Expand Down Expand Up @@ -198,10 +198,10 @@ class NonEmptyListSpec extends UnitSpec {
Every(1) ::: NonEmptyList(2, 3, 4) shouldEqual NonEmptyList(1, 2, 3, 4)
One(1) ::: NonEmptyList(2, 3, 4) shouldEqual NonEmptyList(1, 2, 3, 4)
}
it should "have a ::: method that takes a GenTraversableOnce" in {
it should "have a ::: method that takes a IterableOnce" in {
List(1) ::: NonEmptyList(2, 3, 4) shouldEqual NonEmptyList(1, 2, 3, 4)
Vector(1, 2, 3) ::: NonEmptyList(4, 5, 6) shouldEqual NonEmptyList(1, 2, 3, 4, 5, 6)
GenTraversable(1) ::: NonEmptyList(2, 3, 4) shouldEqual NonEmptyList(1, 2, 3, 4)
Iterable(1) ::: NonEmptyList(2, 3, 4) shouldEqual NonEmptyList(1, 2, 3, 4)
Set(1, 2) ::: NonEmptyList(3, 4, 5) shouldEqual NonEmptyList(1, 2, 3, 4, 5)
Set(1, 2).iterator ::: NonEmptyList(3, 4, 5) shouldEqual NonEmptyList(1, 2, 3, 4, 5)
}
Expand Down Expand Up @@ -463,7 +463,7 @@ class NonEmptyListSpec extends UnitSpec {
NonEmptyList(NonEmptyList(1, 2, 3), NonEmptyList(1, 2, 3)).flatten shouldBe NonEmptyList(1, 2, 3, 1, 2, 3)
NonEmptyList(NonEmptyList(1)).flatten shouldBe NonEmptyList(1)
}
it can "be flattened when in a GenTraversableOnce" in {
it can "be flattened when in a IterableOnce" in {
Vector(NonEmptyList(1, 2, 3), NonEmptyList(1, 2, 3)).flatten shouldBe Vector(1, 2, 3, 1, 2, 3)
List(NonEmptyList(1, 2, 3), NonEmptyList(1, 2, 3)).flatten shouldBe List(1, 2, 3, 1, 2, 3)
List(NonEmptyList(1, 2, 3), NonEmptyList(1, 2, 3)).toIterator.flatten.toStream shouldBe List(1, 2, 3, 1, 2, 3).toIterator.toStream
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package org.scalactic.anyvals

import scala.collection.GenTraversable
import org.scalactic.ColCompatHelper.Iterable
import scala.collection.mutable.Buffer
import scala.collection.mutable.ListBuffer

Expand All @@ -42,7 +42,7 @@ class NonEmptyMapSpec extends UnitSpec {
threesie(2) shouldBe "two"
threesie(3) shouldBe "three"
}
it can "be constructed from a GenTraversable via the from method on NonEmptyMap singleton" in {
it can "be constructed from a Iterable via the from method on NonEmptyMap singleton" in {
NonEmptyMap.from(Map.empty[Int, String]) shouldBe None
NonEmptyMap.from(Map(1 -> "one")) shouldBe Some(NonEmptyMap(1 -> "one"))
NonEmptyMap.from(Map(1 -> "one", 2 -> "two", 3 -> "three")) shouldBe Some(NonEmptyMap(1 -> "one", 2 -> "two", 3 -> "three"))
Expand Down Expand Up @@ -165,10 +165,10 @@ class NonEmptyMapSpec extends UnitSpec {
NonEmptyMap(1 -> "one", 2 -> "two", 3 -> "three") ++ Every(4 -> "four") shouldEqual NonEmptyMap(1 -> "one", 2 -> "two", 3 -> "three", 4 -> "four")
NonEmptyMap(1 -> "one", 2 -> "two", 3 -> "three") ++ One(4 -> "four") shouldEqual NonEmptyMap(1 -> "one", 2 -> "two", 3 -> "three", 4 -> "four")
}
it should "have a ++ method that takes a GenTraversableOnce" in {
it should "have a ++ method that takes a IterableOnce" in {
NonEmptyMap(1 -> "one", 2 -> "two", 3 -> "three") ++ Map(4 -> "four") shouldEqual NonEmptyMap(1 -> "one", 2 -> "two", 3 -> "three", 4 -> "four")
NonEmptyMap(1 -> "one", 2 -> "two", 3 -> "three") ++ Vector(4 -> "four", 5 -> "five", 6 -> "six") shouldEqual NonEmptyMap(5 -> "five", 6 -> "six", 1 -> "one", 2 -> "two", 3 -> "three", 4 -> "four")
NonEmptyMap(1 -> "one", 2 -> "two", 3 -> "three") ++ GenTraversable(4 -> "four") shouldEqual NonEmptyMap(1 -> "one", 2 -> "two", 3 -> "three", 4 -> "four")
NonEmptyMap(1 -> "one", 2 -> "two", 3 -> "three") ++ Iterable(4 -> "four") shouldEqual NonEmptyMap(1 -> "one", 2 -> "two", 3 -> "three", 4 -> "four")
NonEmptyMap(1 -> "one", 2 -> "two", 3 -> "three") ++ Set(4 -> "four", 5 -> "five") shouldEqual NonEmptyMap(1 -> "one", 2 -> "two", 3 -> "three", 4 -> "four", 5 -> "five")
NonEmptyMap(1 -> "one", 2 -> "two", 3 -> "three") ++ Set(4 -> "four", 5 -> "five").iterator shouldEqual NonEmptyMap(1 -> "one", 2 -> "two", 3 -> "three", 4 -> "four", 5 -> "five")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package org.scalactic.anyvals

import scala.collection.GenTraversable
import org.scalactic.ColCompatHelper.Iterable
import scala.collection.mutable.Buffer
import scala.collection.mutable.ListBuffer

Expand Down Expand Up @@ -44,7 +44,7 @@ class NonEmptySetSpec extends UnitSpec {
threesie(3) shouldBe true
threesie(4) shouldBe false
}
it can "be constructed from a GenTraversable via the from method on NonEmptySet singleton" in {
it can "be constructed from a Iterable via the from method on NonEmptySet singleton" in {
NonEmptySet.from(Set.empty[String]) shouldBe None
NonEmptySet.from(Set("1")) shouldBe Some(NonEmptySet("1"))
NonEmptySet.from(Set(1, 2, 3)) shouldBe Some(NonEmptySet(1, 2, 3))
Expand Down Expand Up @@ -148,10 +148,10 @@ class NonEmptySetSpec extends UnitSpec {
NonEmptySet(1, 2, 3) ++ Every(4) shouldEqual NonEmptySet(1, 2, 3, 4)
NonEmptySet(1, 2, 3) ++ One(4) shouldEqual NonEmptySet(1, 2, 3, 4)
}
it should "have a ++ method that takes a GenTraversableOnce" in {
it should "have a ++ method that takes a IterableOnce" in {
NonEmptySet(1, 2, 3) ++ Set(4) shouldEqual NonEmptySet(1, 2, 3, 4)
NonEmptySet(1, 2, 3) ++ Vector(4, 5, 6) shouldEqual NonEmptySet(1, 2, 3, 4, 5, 6)
NonEmptySet(1, 2, 3) ++ GenTraversable(4) shouldEqual NonEmptySet(1, 2, 3, 4)
NonEmptySet(1, 2, 3) ++ Iterable(4) shouldEqual NonEmptySet(1, 2, 3, 4)
NonEmptySet(1, 2, 3) ++ Set(4, 5) shouldEqual NonEmptySet(1, 2, 3, 4, 5)
NonEmptySet(1, 2, 3) ++ Set(4, 5).iterator shouldEqual NonEmptySet(1, 2, 3, 4, 5)
}
Expand Down Expand Up @@ -299,7 +299,7 @@ class NonEmptySetSpec extends UnitSpec {
NonEmptySet(NonEmptySet(1, 2, 3), NonEmptySet(1, 2, 3)).flatten shouldBe NonEmptySet(1, 2, 3, 1, 2, 3)
NonEmptySet(NonEmptySet(1)).flatten shouldBe NonEmptySet(1)
}
it can "be flattened when in a GenTraversableOnce" in {
it can "be flattened when in a IterableOnce" in {
Vector(NonEmptySet(1, 2, 3), NonEmptySet(1, 2, 3)).flatten shouldBe Vector(2, 3, 1, 2, 3, 1)
Set(NonEmptySet(1, 2, 3), NonEmptySet(1, 2, 3)).flatten shouldBe Set(1, 2, 3, 1, 2, 3)
Set(NonEmptySet(1, 2, 3), NonEmptySet(1, 2, 3)).toIterator.flatten.toStream shouldBe Set(2, 3, 1, 2, 3, 1).toIterator.toStream
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package org.scalactic.anyvals

import scala.collection.GenTraversable
import org.scalactic.ColCompatHelper.Iterable
import scala.collection.mutable.Buffer
import scala.collection.mutable.ListBuffer

Expand Down Expand Up @@ -58,7 +58,7 @@ class NonEmptyStringSpec extends UnitSpec {
threesie2(1) shouldBe '2'
threesie2(2) shouldBe '3'
}
it can "be constructed from a GenTraversable via the from method on NonEmptyString singleton" in {
it can "be constructed from a Iterable via the from method on NonEmptyString singleton" in {
NonEmptyString.from("") shouldBe None
NonEmptyString.from("1") shouldBe Some(NonEmptyString("1"))
NonEmptyString.from("123") shouldBe Some(NonEmptyString("123"))
Expand Down Expand Up @@ -104,10 +104,10 @@ class NonEmptyStringSpec extends UnitSpec {
NonEmptyString("123") ++ Every('4') shouldEqual NonEmptyString("1234")
NonEmptyString("123") ++ One('4') shouldEqual NonEmptyString("1234")
}
it should "have a ++ method that takes a GenTraversableOnce" in {
it should "have a ++ method that takes a IterableOnce" in {
NonEmptyString("123") ++ "4" shouldEqual NonEmptyString("1234")
NonEmptyString("123") ++ Vector('4', '5', '6') shouldEqual NonEmptyString("123456")
NonEmptyString("123") ++ GenTraversable('4') shouldEqual NonEmptyString("1234")
NonEmptyString("123") ++ Iterable('4') shouldEqual NonEmptyString("1234")
NonEmptyString("123") ++ Set('4', '5') shouldEqual NonEmptyString("12345")
NonEmptyString("123") ++ Set('4', '5').iterator shouldEqual NonEmptyString("12345")
}
Expand Down Expand Up @@ -348,7 +348,7 @@ class NonEmptyStringSpec extends UnitSpec {
NonEmptyString("5") flatMap (i => NonEmptyString(i + "3")) shouldBe NonEmptyString("53")
NonEmptyString("8") flatMap (i => NonEmptyString(i.toString)) shouldBe NonEmptyString("8")
}
it can "be flattened when in a GenTraversableOnce" in {
it can "be flattened when in a IterableOnce" in {
Vector(NonEmptyString("123"), NonEmptyString("123")).flatten shouldBe Vector('1', '2', '3', '1', '2', '3')
List(NonEmptyString("123"), NonEmptyString("123")).flatten shouldBe List('1', '2', '3', '1', '2', '3')
// SKIP-SCALATESTJS,NATIVE-START
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package org.scalactic.anyvals

import scala.collection.GenTraversable
import org.scalactic.ColCompatHelper.Iterable
import scala.collection.mutable.Buffer
import scala.collection.mutable.ListBuffer

Expand All @@ -42,7 +42,7 @@ class NonEmptyVectorSpec extends UnitSpec {
threesie(1) shouldBe 2
threesie(2) shouldBe 3
}
it can "be constructed from a GenTraversable via the from method on NonEmptyVector singleton" in {
it can "be constructed from a Iterable via the from method on NonEmptyVector singleton" in {
NonEmptyVector.from(Vector.empty[String]) shouldBe None
NonEmptyVector.from(Vector("1")) shouldBe Some(NonEmptyVector("1"))
NonEmptyVector.from(Vector(1, 2, 3)) shouldBe Some(NonEmptyVector(1, 2, 3))
Expand Down Expand Up @@ -163,10 +163,10 @@ class NonEmptyVectorSpec extends UnitSpec {
NonEmptyVector(1, 2, 3) ++ Every(4) shouldEqual NonEmptyVector(1, 2, 3, 4)
NonEmptyVector(1, 2, 3) ++ One(4) shouldEqual NonEmptyVector(1, 2, 3, 4)
}
it should "have a ++ method that takes a GenTraversableOnce" in {
it should "have a ++ method that takes a IterableOnce" in {
NonEmptyVector(1, 2, 3) ++ Vector(4) shouldEqual NonEmptyVector(1, 2, 3, 4)
NonEmptyVector(1, 2, 3) ++ Vector(4, 5, 6) shouldEqual NonEmptyVector(1, 2, 3, 4, 5, 6)
NonEmptyVector(1, 2, 3) ++ GenTraversable(4) shouldEqual NonEmptyVector(1, 2, 3, 4)
NonEmptyVector(1, 2, 3) ++ Iterable(4) shouldEqual NonEmptyVector(1, 2, 3, 4)
NonEmptyVector(1, 2, 3) ++ Set(4, 5) shouldEqual NonEmptyVector(1, 2, 3, 4, 5)
NonEmptyVector(1, 2, 3) ++ Set(4, 5).iterator shouldEqual NonEmptyVector(1, 2, 3, 4, 5)
}
Expand Down Expand Up @@ -427,7 +427,7 @@ class NonEmptyVectorSpec extends UnitSpec {
NonEmptyVector(NonEmptyVector(1, 2, 3), NonEmptyVector(1, 2, 3)).flatten shouldBe NonEmptyVector(1, 2, 3, 1, 2, 3)
NonEmptyVector(NonEmptyVector(1)).flatten shouldBe NonEmptyVector(1)
}
it can "be flattened when in a GenTraversableOnce" in {
it can "be flattened when in a IterableOnce" in {
Vector(NonEmptyVector(1, 2, 3), NonEmptyVector(1, 2, 3)).flatten shouldBe Vector(1, 2, 3, 1, 2, 3)
Vector(NonEmptyVector(1, 2, 3), NonEmptyVector(1, 2, 3)).flatten shouldBe Vector(1, 2, 3, 1, 2, 3)
Vector(NonEmptyVector(1, 2, 3), NonEmptyVector(1, 2, 3)).toIterator.flatten.toStream shouldBe Vector(1, 2, 3, 1, 2, 3).toIterator.toStream
Expand Down

0 comments on commit 632948c

Please sign in to comment.