Skip to content

Commit c5eb1bc

Browse files
committed
add test for transparent compiler respecting nowarn hash directives
1 parent e62c29d commit c5eb1bc

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/service/ExprTests.fs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3605,3 +3605,27 @@ let ``Test ProjectForWitnesses4 GetWitnessPassingInfo`` useTransparentCompiler =
36053605
printfn "actual:\n\n%A" actual
36063606
actual
36073607
|> shouldPairwiseEqual expected
3608+
3609+
module internal ProjectForNoWarnHashDirective =
3610+
3611+
let fileSource1 = """
3612+
module N.M
3613+
#nowarn "40"
3614+
let rec f = new System.EventHandler(fun _ _ -> f.Invoke(null,null))
3615+
"""
3616+
3617+
let createOptions() = createOptionsAux [fileSource1] []
3618+
3619+
[<TestCase(false)>]
3620+
[<TestCase(true)>]
3621+
[<Test>]
3622+
let ``Test NoWarn HashDirective`` useTransparentCompiler =
3623+
let cleanup, options = ProjectForNoWarnHashDirective.createOptions()
3624+
use _holder = cleanup
3625+
let exprChecker = FSharpChecker.Create(keepAssemblyContents=true, useTransparentCompiler=useTransparentCompiler)
3626+
let wholeProjectResults = exprChecker.ParseAndCheckProject(options) |> Async.RunImmediate
3627+
3628+
for e in wholeProjectResults.Diagnostics do
3629+
printfn "ProjectForNoWarnHashDirective error: <<<%s>>>" e.Message
3630+
3631+
wholeProjectResults.Diagnostics.Length |> shouldEqual 0

0 commit comments

Comments
 (0)