Skip to content

Commit f2c33f0

Browse files
committed
address null directly
(cherry picked from commit 4940d89a4b717d9f1a20dbfc82156467f8dc12bc)
1 parent ba8fddf commit f2c33f0

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

tests/authoring/Applicability/AppliesToFrontMatter.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ applies_to:
2424
"""
2525
[<Fact>]
2626
let ``apply matches expected`` () =
27-
markdown |> appliesTo (Unchecked.defaultof<ApplicableTo>)
27+
markdown |> appliesTo Unchecked.defaultof<ApplicableTo>
2828

2929
type ``apply default to top level arguments`` () =
3030
static let markdown = frontMatter """
@@ -212,7 +212,7 @@ applies_to:
212212
"""
213213
[<Fact>]
214214
let ``does not render label`` () =
215-
markdown |> appliesTo (Unchecked.defaultof<ApplicableTo>)
215+
markdown |> appliesTo Unchecked.defaultof<ApplicableTo>
216216

217217
type ``parses applies_to with multiple categories in any order`` () =
218218
static let markdown = frontMatter """

tests/authoring/Framework/MarkdownDocumentAssertions.fs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,19 @@ module MarkdownDocumentAssertions =
2727
unsupportedBlocks
2828

2929
[<DebuggerStepThrough>]
30-
let appliesTo (expectedAvailability: ApplicableTo) (actual: Lazy<GeneratorResults>) =
30+
let appliesTo (expectedAvailability: ApplicableTo | null) (actual: Lazy<GeneratorResults>) =
3131
let actual = actual.Value
3232
let result = actual.MarkdownResults |> Seq.find (fun r -> r.File.RelativePath = "index.md")
3333
let matter = result.File.YamlFrontMatter
3434
match matter with
3535
| NonNull m ->
36-
m.AppliesTo.Diagnostics <- expectedAvailability.Diagnostics
36+
match expectedAvailability with
37+
| NonNull a -> m.AppliesTo.Diagnostics <- a.Diagnostics
38+
| _ -> ()
39+
3740
let apply = m.AppliesTo
3841
test <@ apply = expectedAvailability @>
39-
| _ -> failwithf "%s has no yamlfront matter" result.File.RelativePath
42+
| _ -> failwithf $"%s{result.File.RelativePath} has no yamlfront matter"
4043

4144

4245
[<DebuggerStepThrough>]

0 commit comments

Comments
 (0)