Skip to content

Commit 17066f0

Browse files
committed
make language version an inline data and keep source code in test body
1 parent 93a88e5 commit 17066f0

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

tests/FSharp.Compiler.ComponentTests/Conformance/TypesAndTypeConstraints/IWSAMsAndSRTPs/IWSAMsAndSRTPsTests.fs

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -325,28 +325,23 @@ module ``Type checking behavior`` =
325325
#if !NETCOREAPP
326326
[<Theory(Skip = "IWSAMs are not supported by NET472.")>]
327327
#else
328-
[<InlineData("""
328+
[<InlineData("6.0")>]
329+
[<InlineData("7.0")>]
330+
[<Theory>]
331+
#endif
332+
let ``Extension method on interface without SAM does not produce a warning`` version =
333+
Fsx """
329334
type INormalInterface =
330335
abstract member IntMember: int
331336
332337
module INormalInterfaceExtensions =
333338
type INormalInterface with
334339
static member ExtMethod (a: INormalInterface) =
335-
()""")>]
336-
[<Theory>]
337-
#endif
338-
let ``Extension method on interface without SAM does not produce a warning`` code =
339-
Fsx code
340-
|> withLangVersion60
341-
|> compile
342-
|> shouldSucceed
343-
|> ignore
344-
345-
Fsx code
346-
|> withLangVersion70
340+
()
341+
"""
342+
|> withLangVersion version
347343
|> compile
348344
|> shouldSucceed
349-
|> ignore
350345

351346
module Negative =
352347

tests/FSharp.Test.Utilities/Compiler.fs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,9 @@ module rec Compiler =
393393

394394
let withLangVersionPreview (cUnit: CompilationUnit) : CompilationUnit =
395395
withOptionsHelper [ "--langversion:preview" ] "withLangVersionPreview is only supported on F#" cUnit
396+
397+
let withLangVersion (version: string) (cUnit: CompilationUnit) : CompilationUnit =
398+
withOptionsHelper [ $"--langversion:{version}" ] "withLangVersion is only supported on F#" cUnit
396399

397400
let withAssemblyVersion (version:string) (cUnit: CompilationUnit) : CompilationUnit =
398401
withOptionsHelper [ $"--version:{version}" ] "withAssemblyVersion is only supported on F#" cUnit

0 commit comments

Comments
 (0)