Skip to content

Commit 1bc8b11

Browse files
ceedubsjohnynek
authored andcommitted
Test that Vector's traverse short-circuits (#2092)
This adds a test case that the `traverse` implementation for `Vector` short-circuits the traversal when possible. This would have failed the build in #2091. See #1015 for when similar tests were added for similar structures.
1 parent 8bb5c01 commit 1bc8b11

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/src/test/scala/cats/tests/RegressionSuite.scala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,18 @@ class RegressionSuite extends CatsSuite {
113113
NonEmptyList.of(6,8).traverse(validate) should === (Either.left("6 is greater than 5"))
114114
checkAndResetCount(1)
115115

116+
Vector(1,2,6,8).traverse(validate) should === (Either.left("6 is greater than 5"))
117+
checkAndResetCount(3)
118+
116119
List(1,2,6,8).traverse_(validate) should === (Either.left("6 is greater than 5"))
117120
checkAndResetCount(3)
118121

122+
Stream(1,2,6,8).traverse_(validate) should === (Either.left("6 is greater than 5"))
123+
checkAndResetCount(3)
124+
125+
Vector(1,2,6,8).traverse_(validate) should === (Either.left("6 is greater than 5"))
126+
checkAndResetCount(3)
127+
119128
NonEmptyList.of(1,2,6,7,8).traverse_(validate) should === (Either.left("6 is greater than 5"))
120129
checkAndResetCount(3)
121130

0 commit comments

Comments
 (0)