Skip to content

Commit 82a146d

Browse files
committed
Bugfix: Prevent extreme memory usage during ButtonTests
1 parent d0a789b commit 82a146d

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/test/scala/org/nlogo/models/ButtonTests.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class ButtonTests extends TestModels {
2727
).contains(model.name))
2828
}.par.toMap
2929

30-
def run(model: Model, button: Button): Try[World] = Try {
30+
private def run(model: Model, button: Button): Try[Double] = Try {
3131
withWorkspace(model) { ws =>
3232
button.source.foreach { source =>
3333
val code = button.buttonKind match {
@@ -49,7 +49,7 @@ class ButtonTests extends TestModels {
4949
.filterNot(_.getMessage.endsWith("You can't get user input headless."))
5050
.foreach(throw _)
5151
}
52-
ws.world
52+
ws.world.ticks
5353
}
5454
}
5555

@@ -74,7 +74,7 @@ class ButtonTests extends TestModels {
7474
modelButtons <- buttons.get(model)
7575
if modelButtons.exists(_.disableUntilTicksStart)
7676
enabledButtons = modelButtons.filterNot(_.disableUntilTicksStart)
77-
if !enabledButtons.exists(b => run(model, b).filter(_.ticks != -1).isSuccess)
77+
if !enabledButtons.exists(b => run(model, b).filter(_ != -1).isSuccess)
7878
} yield ""
7979
}
8080
}

0 commit comments

Comments
 (0)