Skip to content

Commit 7c6ecd6

Browse files
committed
add unit test
1 parent 3beb547 commit 7c6ecd6

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

Chickensoft.LogicBlocks.Tests/test/src/LogicBlockTest.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,27 @@ public void ImplicitStartCallsOnStart() {
373373
onStartCalled.ShouldBeTrue();
374374
}
375375

376+
[Fact]
377+
public void OnStartDoesNotCauseInfiniteLoopWithInput() {
378+
var onStartCalled = false;
379+
var looped = false;
380+
var logic = new FakeLogicBlock();
381+
logic.OnStartCalled += () => {
382+
if (onStartCalled) {
383+
looped = true;
384+
return;
385+
}
386+
387+
onStartCalled = true;
388+
logic.Input(new FakeLogicBlock.Input.InputOne(2, 3));
389+
};
390+
391+
logic.Start();
392+
393+
onStartCalled.ShouldBeTrue();
394+
looped.ShouldBeFalse();
395+
}
396+
376397
[Fact]
377398
public void StopExitsState() {
378399
var exitCalled = false;

0 commit comments

Comments
 (0)