Skip to content

Commit 42e1323

Browse files
authored
Merge pull request #1045 from fabulous-dev/more-test-to-bullet-proof-collection-builders
More tests to validate an issue where Multiple for loops in builder causes crash
2 parents 1dd6044 + 4decad1 commit 42e1323

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

src/Fabulous.Tests/APISketchTests/APISketchTests.fs

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,59 @@ module Issue104 =
687687

688688
instance.ProcessMessage(Toggle)
689689

690+
module Issue1044 =
691+
[<Test>]
692+
let ``Multiple Widgets + for loops in builder causes crash`` () =
693+
let view model =
694+
Stack() {
695+
Label($"Foo") // It also crashes only with the multiple for loops
696+
Label($"bar") // It also crashes only with the multiple for loops
697+
698+
for i = 0 to 10 do
699+
Label($"T{i}")
700+
701+
for i = 10 to 20 do
702+
Label($"T{i}")
703+
704+
for i = 20 to 30 do
705+
Label($"T{i}")
706+
707+
for i = 30 to 40 do
708+
Label($"T{i}")
709+
}
710+
711+
let init () = true
712+
let update (_: unit) msg = not msg
713+
let program = StatefulWidget.mkSimpleView init update view
714+
715+
let instance = Run.Instance program
716+
instance.Start() |> ignore
717+
718+
[<Test>]
719+
let ``Multiple for loops in builder causes crash`` () =
720+
let view model =
721+
Stack() {
722+
for i = 0 to 10 do
723+
Label($"T{i}")
724+
725+
for i = 10 to 20 do
726+
Label($"T{i}")
727+
728+
for i = 20 to 30 do
729+
Label($"T{i}")
730+
731+
for i = 30 to 40 do
732+
Label($"T{i}")
733+
}
734+
735+
let init () = true
736+
let update (_: unit) msg = not msg
737+
let program = StatefulWidget.mkSimpleView init update view
738+
739+
let instance = Run.Instance program
740+
instance.Start() |> ignore
741+
742+
690743
module Attributes =
691744

692745
type MyEnum =

0 commit comments

Comments
 (0)