Skip to content

Commit

Permalink
rename and speedup test
Browse files Browse the repository at this point in the history
  • Loading branch information
majocha committed May 6, 2024
1 parent 87ccfa3 commit f4cf7e6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/FSharp.Compiler.UnitTests/BuildGraphTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -239,13 +239,13 @@ module BuildGraphTests =
type ExampleException(msg) = inherit System.Exception(msg)

[<Fact>]
let internal ``NodeCode preserves DiagnosticsThreadStatics`` () =
let internal ``DiagnosticsThreadStatics preserved in async`` () =
let random =
let rng = Random()
fun n -> rng.Next n

let job phase i = async {
do! random 10 |> Async.Sleep
do! random 5 |> Async.Sleep
Assert.Equal(phase, DiagnosticsThreadStatics.BuildPhase)
DiagnosticsThreadStatics.DiagnosticsLogger.DebugDisplay()
|> Assert.shouldBe $"DiagnosticsLogger(CaptureDiagnosticsConcurrently {i})"
Expand All @@ -262,7 +262,7 @@ module BuildGraphTests =

let diags = logger.Diagnostics |> List.map fst

diags |> List.map _.Phase |> Set |> Assert.shouldBe (Set.singleton phase)
diags |> List.map _.Phase |> List.distinct |> Assert.shouldBe [ phase ]
diags |> List.map _.Exception.Message
|> Assert.shouldBe (List.init n <| sprintf "job %d")

Expand All @@ -284,7 +284,7 @@ module BuildGraphTests =
|]

let pickRandomPhase _ = phases[random phases.Length]
Seq.init 100 pickRandomPhase
Seq.init 20 pickRandomPhase
|> Seq.map work
|> Async.Parallel
|> Async.RunSynchronously
Expand Down

0 comments on commit f4cf7e6

Please sign in to comment.