Skip to content

Commit d145bba

Browse files
authored
repeat until/whilst are combinable with times (#272)
* repeat until/whilst are combinable with `times` * toSetMutable for scala3
1 parent 316765a commit d145bba

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

traversal/src/test/scala/overflowdb/traversal/RepeatTraversalTests.scala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ class RepeatTraversalTests extends AnyWordSpec {
113113
centerTrav.repeat(_.out)(_.until(_.hasLabel(Thing.Label))).property(Name).toSetMutable shouldBe expectedResults
114114
centerTrav.repeat(_.out)(_.until(_.hasLabel(Thing.Label)).breadthFirstSearch).property(Name).toSetMutable shouldBe expectedResults
115115
}
116+
117+
"be combinable with `.times`" in {
118+
centerTrav.repeat(_.followedBy)(_.until(_.name("R2")).times(3)).name.toSetMutable shouldBe Set("L3", "R2")
119+
}
120+
116121
}
117122

118123
"support repeat/while behaviour" should {
@@ -149,6 +154,10 @@ class RepeatTraversalTests extends AnyWordSpec {
149154
Seq(center, l1),
150155
)
151156
}
157+
158+
"be combinable with `.times`" in {
159+
centerTrav.repeat(_.followedBy)(_.whilst(_.nameNot("R2")).times(3)).name.toSetMutable shouldBe Set("L3", "R2")
160+
}
152161
}
153162

154163
".dedup should apply to all repeat iterations" when {

0 commit comments

Comments
 (0)