Skip to content

Commit

Permalink
Merge pull request #1045 from fabulous-dev/more-test-to-bullet-proof-…
Browse files Browse the repository at this point in the history
…collection-builders

More tests to validate an issue where Multiple for loops in builder causes crash
  • Loading branch information
edgarfgp committed Jun 5, 2023
2 parents 1dd6044 + 4decad1 commit 42e1323
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions src/Fabulous.Tests/APISketchTests/APISketchTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,59 @@ module Issue104 =

instance.ProcessMessage(Toggle)

module Issue1044 =
[<Test>]
let ``Multiple Widgets + for loops in builder causes crash`` () =
let view model =
Stack() {
Label($"Foo") // It also crashes only with the multiple for loops
Label($"bar") // It also crashes only with the multiple for loops

for i = 0 to 10 do
Label($"T{i}")

for i = 10 to 20 do
Label($"T{i}")

for i = 20 to 30 do
Label($"T{i}")

for i = 30 to 40 do
Label($"T{i}")
}

let init () = true
let update (_: unit) msg = not msg
let program = StatefulWidget.mkSimpleView init update view

let instance = Run.Instance program
instance.Start() |> ignore

[<Test>]
let ``Multiple for loops in builder causes crash`` () =
let view model =
Stack() {
for i = 0 to 10 do
Label($"T{i}")

for i = 10 to 20 do
Label($"T{i}")

for i = 20 to 30 do
Label($"T{i}")

for i = 30 to 40 do
Label($"T{i}")
}

let init () = true
let update (_: unit) msg = not msg
let program = StatefulWidget.mkSimpleView init update view

let instance = Run.Instance program
instance.Start() |> ignore


module Attributes =

type MyEnum =
Expand Down

0 comments on commit 42e1323

Please sign in to comment.