File tree Expand file tree Collapse file tree 4 files changed +18
-8
lines changed
src/Elastic.Markdown/Diagnostics
tests/authoring/Framework Expand file tree Collapse file tree 4 files changed +18
-8
lines changed Original file line number Diff line number Diff line change 7474 seq {
7575 for c in cases do
7676 if c.GetFields() .Length = 0 then
77- FSharpValue.MakeUnion( c, [| |]) :?> Build
77+ match FSharpValue.MakeUnion( c, [| |]) with
78+ | NonNull u -> u :?> Build
79+ | _ -> failwithf $" %s {c.Name} can not be cast to Build enum"
7880 }
7981
8082 static member Ignore ( _ : Build ) _ = ()
Original file line number Diff line number Diff line change 1212 <PackageReference Include =" Proc.Fs" Version =" 0.9.1" />
1313 <PackageReference Include =" Fake.Tools.Git" Version =" 6.1.3" />
1414 <PackageReference Include =" Fake.IO.Zip" Version =" 6.1.3" />
15- <PackageReference Remove =" FSharp.Core" />
16- <PackageReference Include =" FSharp.Core" Version =" 9.0.100" />
1715 </ItemGroup >
1816
1917 <ItemGroup >
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ public readonly record struct Diagnostic
5656
5757public interface IDiagnosticsOutput
5858{
59- public void Write ( Diagnostic diagnostic ) ;
59+ void Write ( Diagnostic diagnostic ) ;
6060}
6161
6262public class DiagnosticsCollector ( IReadOnlyCollection < IDiagnosticsOutput > outputs )
Original file line number Diff line number Diff line change @@ -27,8 +27,14 @@ module DiagnosticsCollectorAssertions =
2727 .Where( fun d -> d.Severity = Severity.Error)
2828 .ToArray()
2929 |> List.ofArray
30- let message = errorDiagnostics.FirstOrDefault() .Message
31- test <@ message.Contains( expected) @>
30+ |> List.tryHead
31+
32+ match errorDiagnostics with
33+ | Some e ->
34+ let message = e.Message
35+ test <@ message.Contains( expected) @>
36+ | None -> failwithf " Expected errors but no errors were logged"
37+
3238
3339 let hasNoWarnings ( actual : Lazy < GeneratorResults >) =
3440 let actual = actual.Value
@@ -43,5 +49,9 @@ module DiagnosticsCollectorAssertions =
4349 .Where( fun d -> d.Severity = Severity.Warning)
4450 .ToArray()
4551 |> List.ofArray
46- let message = errorDiagnostics.FirstOrDefault() .Message
47- test <@ message.Contains( expected) @>
52+ |> List.tryHead
53+ match errorDiagnostics with
54+ | Some e ->
55+ let message = e.Message
56+ test <@ message.Contains( expected) @>
57+ | None -> failwithf " Expected errors but no errors were logged"
You can’t perform that action at this time.
0 commit comments