diff --git a/tests/FSharp.Compiler.ComponentTests/Language/CodeQuotationTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/CodeQuotationTests.fs index 03712d32e1a..04e39bdb824 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/CodeQuotationTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/CodeQuotationTests.fs @@ -36,6 +36,6 @@ let z : unit = failwithf "did not expect expression for 'z': %A" e """ |> asExe - |> withOptions ["--langversion:preview"] + |> withPreview |> compileAndRun |> shouldSucceed diff --git a/tests/FSharp.Test.Utilities/Compiler.fs b/tests/FSharp.Test.Utilities/Compiler.fs index b31da1d4866..4e1850dbdc8 100644 --- a/tests/FSharp.Test.Utilities/Compiler.fs +++ b/tests/FSharp.Test.Utilities/Compiler.fs @@ -176,6 +176,11 @@ module rec Compiler = | FS fs -> FS { fs with Options = options } | _ -> failwith "withOptions is only supported n F#" + let withPreview (cUnit: CompilationUnit) : CompilationUnit = + match cUnit with + | FS fs -> FS { fs with Options = [ "--langversion:preview" ] } + | _ -> failwith "withPreview is only supported in F#" + let asLibrary (cUnit: CompilationUnit) : CompilationUnit = match cUnit with | FS fs -> FS { fs with OutputType = CompileOutput.Library } diff --git a/tests/fsharp/Compiler/Language/WitnessTests.fs b/tests/fsharp/Compiler/Language/WitnessTests.fs index 67f383c7827..f5f94eb9756 100644 --- a/tests/fsharp/Compiler/Language/WitnessTests.fs +++ b/tests/fsharp/Compiler/Language/WitnessTests.fs @@ -19,7 +19,7 @@ module WitnessTests = """ (dir ++ "provider.fsx")) |> asExe |> ignoreWarnings - |> withOptions ["--langversion:preview"] + |> withPreview |> compile |> shouldSucceed |> ignore