diff --git a/azure-pipelines.yml b/azure-pipelines.yml index d1ee7e1e3c4..9a7b19618fd 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -444,6 +444,8 @@ stages: - checkout: self clean: true - script: ./eng/cibuild.sh --configuration $(_BuildConfig) --testcoreclr + env: + COMPlus_DefaultStackSize: 1000000 displayName: Build / Test - task: PublishTestResults@2 displayName: Publish Test Results diff --git a/src/Compiler/Checking/CheckExpressions.fs b/src/Compiler/Checking/CheckExpressions.fs index 806b516dccd..19d8f2cbaaa 100644 --- a/src/Compiler/Checking/CheckExpressions.fs +++ b/src/Compiler/Checking/CheckExpressions.fs @@ -6970,17 +6970,22 @@ and TcConstStringExpr cenv (overallTy: OverallTy) env m tpenv (s: string) litera | _ -> false let g = cenv.g + - if isFormat g overallTy.Commit then - if literalType = LiteralArgumentType.StaticField then - checkLanguageFeatureAndRecover g.langVersion LanguageFeature.NonInlineLiteralsAsPrintfFormat m + match isFormat g overallTy.Commit, literalType with + | true, LiteralArgumentType.StaticField -> + checkLanguageFeatureAndRecover g.langVersion LanguageFeature.NonInlineLiteralsAsPrintfFormat m + TcFormatStringExpr cenv overallTy env m tpenv s literalType + | true, LiteralArgumentType.Inline -> TcFormatStringExpr cenv overallTy env m tpenv s literalType - else - if literalType = LiteralArgumentType.Inline && not (isObjTy g overallTy.Commit) then - AddCxTypeEqualsType env.eContextInfo env.DisplayEnv cenv.css m overallTy.Commit g.string_ty - mkString g m s, tpenv + | false, LiteralArgumentType.StaticField -> + Expr.Const (TcFieldInit m (ILFieldInit.String s), m, g.string_ty), tpenv + + | false, LiteralArgumentType.Inline -> + TcPropagatingExprLeafThenConvert cenv overallTy g.string_ty env (* true *) m (fun () -> + mkString g m s, tpenv) and TcFormatStringExpr cenv (overallTy: OverallTy) env m tpenv (fmtString: string) formatStringLiteralType = let g = cenv.g diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalFiltering/OffsideExceptions/OffsideExceptions.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalFiltering/OffsideExceptions/OffsideExceptions.fs index f00e227c826..ffc44b00032 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalFiltering/OffsideExceptions/OffsideExceptions.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalFiltering/OffsideExceptions/OffsideExceptions.fs @@ -5,8 +5,10 @@ namespace FSharp.Compiler.ComponentTests.Conformance.LexicalFiltering.Basic open Xunit open FSharp.Test open FSharp.Test.Compiler +open FSharp.Test.Compiler.Assertions.StructuredResultsAsserts module OffsideExceptions = + type FileAttribute(file) = inherit DirectoryAttribute(__SOURCE_DIRECTORY__, Includes=[|file|]) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Enums.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Enums.fs index 33217909d2a..98df4894328 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Enums.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Enums.fs @@ -4,6 +4,7 @@ namespace FSharp.Compiler.ComponentTests.EmittedIL open Xunit open FSharp.Test.Compiler +open FSharp.Test.Compiler.Assertions.StructuredResultsAsserts module Enums = diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Literals.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Literals.fs index 570f22d1377..c168d88fba4 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Literals.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Literals.fs @@ -4,6 +4,7 @@ namespace FSharp.Compiler.ComponentTests.EmittedIL open Xunit open FSharp.Test.Compiler +open FSharp.Test.Compiler.Assertions.StructuredResultsAsserts module ``Literals`` = diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/UnsupportedAttributes.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/UnsupportedAttributes.fs index fa981de2a14..be59b17509b 100644 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/UnsupportedAttributes.fs +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/UnsupportedAttributes.fs @@ -4,6 +4,7 @@ namespace FSharp.Compiler.ComponentTests.ErrorMessages open Xunit open FSharp.Test.Compiler +open FSharp.Test.Compiler.Assertions.StructuredResultsAsserts module ``Unsupported Attributes`` = diff --git a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj index f6372bf61cf..d6bf558b6c1 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj +++ b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj @@ -227,6 +227,10 @@ + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/Language/PrintfFormatTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/PrintfFormatTests.fs index be034de402a..065ca2070ce 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/PrintfFormatTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/PrintfFormatTests.fs @@ -4,6 +4,7 @@ module FSharp.Compiler.ComponentTests.Language.PrintfFormatTests open Xunit open FSharp.Test.Compiler +open StructuredResultsAsserts [] let ``Constant defined in C# can be used as printf format``() = @@ -32,7 +33,7 @@ module PrintfFormatTests [] let Format = "%d" -if sprintf Format Format.Length <> "2" then +if sprintf Format (Format.Length) <> "2" then failwith "failed" """ |> withLangVersionPreview diff --git a/tests/FSharp.Compiler.ComponentTests/Language/SequenceExpressionTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/SequenceExpressionTests.fs index 5542717a94a..9f87a5078eb 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/SequenceExpressionTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/SequenceExpressionTests.fs @@ -4,10 +4,10 @@ module FSharp.Compiler.ComponentTests.Language.SequenceExpressionTests open Xunit open FSharp.Test.Compiler +open FSharp.Test.ScriptHelpers - -let fsiSession = getSessionForEval() +let fsiSession = getSessionForEval [||] LangVersion.Preview let runCode = evalInSharedSession fsiSession diff --git a/tests/FSharp.Compiler.ComponentTests/Miscellaneous/FsharpSuiteMigrated.fs b/tests/FSharp.Compiler.ComponentTests/Miscellaneous/FsharpSuiteMigrated.fs new file mode 100644 index 00000000000..1b2c02d4b2b --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Miscellaneous/FsharpSuiteMigrated.fs @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace FSharp.Compiler.ComponentTests.Miscellaneous.FsharpSuiteMigrated + +open System +open System.IO +open Xunit +open FSharp.Test +open FSharp.Test.Compiler +open FSharp.Test.ScriptHelpers + + + +module Configuration = + let supportedNames = set ["testlib.fsi";"testlib.fs";"test.mli";"test.ml";"test.fsi";"test.fs";"test2.fsi";"test2.fs";"test.fsx";"test2.fsx"] + +module ScriptRunner = + open Internal.Utilities.Library + + let private createEngine(args,version) = + getSessionForEval args version + + let defaultDefines = + [ +#if NETCOREAPP + "NETCOREAPP" +#endif + ] + + let runScriptFile version (cu:CompilationUnit) = + let cu = cu |> withDefines defaultDefines + match cu with + | FS fsSource -> + File.Delete("test.ok") + let engine = createEngine (fsSource.Options |> Array.ofList,version) + let res = evalScriptFromDiskInSharedSession engine cu + match res with + | CompilationResult.Failure _ -> res + | CompilationResult.Success s -> + if File.Exists("test.ok") then + res + else + failwith $"Results looked correct, but 'test.ok' file was not created. Result: %A{s}" + + | _ -> failwith $"Compilation unit other than fsharp is not supported, cannot process %A{cu}" + +/// This test file was created by porting over (slower) FsharpSuite.Tests +/// In order to minimize human error, the test definitions have been copy-pasted and this adapter provides implementations of the test functions +module TestFrameworkAdapter = + open FSharp.Test.Compiler.Assertions.TextBasedDiagnosticAsserts + + type ExecutionMode = + | FSC_DEBUG + | FSC_OPTIMIZED + | FSI + | COMPILED_EXE_APP + | NEG_TEST_BUILD of testName:string + + let baseFolder = Path.Combine(__SOURCE_DIRECTORY__,"..","..","fsharp") |> Path.GetFullPath + + let diffNegativeBaseline (cr:CompilationUnit) absFolder testName _version = + let expectedFiles = Directory.GetFiles(absFolder, testName + ".*") + let baselines = + [ for f in expectedFiles do + match Path.GetExtension(f) with + | ".bsl" -> cr, f + | ".vsbsl" -> cr |> withOptions ["--test:ContinueAfterParseFailure"], f + | _ -> () ] + [ for compilationUnit,baseline in baselines do + compilationUnit + |> typecheck + |> withResultsMatchingFile baseline ] + |> List.head + + + let adjustVersion version bonusArgs = + match version with + | LangVersion.V47 -> "4.7",bonusArgs + | LangVersion.V50 -> "5.0",bonusArgs + | LangVersion.V60 -> "6.0",bonusArgs + | LangVersion.V70 -> "7.0",bonusArgs + | LangVersion.Preview -> "preview",bonusArgs + | LangVersion.Latest -> "latest", bonusArgs + | LangVersion.SupportsMl -> "5.0", "--mlcompatibility" :: bonusArgs + + + let singleTestBuildAndRunAuxVersion (folder:string) bonusArgs mode langVersion = + let absFolder = Path.Combine(baseFolder,folder) + let supportedNames, files = + match mode with + | NEG_TEST_BUILD testName -> + let nameSet = + Configuration.supportedNames + .Add(testName+".fsx") + .Add(testName+".fs") + .Add(testName+".fsi") + .Add(testName+"-pre.fs") + let files = Directory.GetFiles(absFolder,"*.fs*") |> Array.filter(fun n -> nameSet.Contains(Path.GetFileName(n))) + nameSet, files + | _ -> Configuration.supportedNames, Directory.GetFiles(absFolder,"test*.fs*") + + let mainFile,otherFiles = + match files.Length with + | 0 -> Directory.GetFiles(absFolder,"*.ml") |> Array.exactlyOne, [||] + | 1 -> files |> Array.exactlyOne, [||] + | _ -> + let mainFile,dependencies = + files + |> Array.filter (fun n -> supportedNames.Contains(Path.GetFileName(n))) + // Convention in older FsharpSuite: test2 goes last, longer names like testlib before test, .fsi before .fs on equal filenames + |> Array.sortBy (fun n -> n.Contains("test2"), -n.IndexOf('.'), n.EndsWith(".fsi") |> not) + |> Array.splitAt 1 + + mainFile[0],dependencies + + let version,bonusArgs = adjustVersion langVersion bonusArgs + + FsFromPath mainFile + |> withAdditionalSourceFiles [for f in otherFiles -> SourceFromPath f] + |> withLangVersion version + |> fun cu -> + match mode with + | FSC_DEBUG | FSC_OPTIMIZED | FSI | COMPILED_EXE_APP -> + cu + |> ignoreWarnings + |> withOptions (["--nowarn:0988;3370"] @ bonusArgs) + | NEG_TEST_BUILD _ -> + cu |> + withOptions (["--vserrors";"--maxerrors:10000";"--warnaserror";"--warn:3";"--nowarn:20;21;1178;52"] @ bonusArgs) + |> fun cu -> + match mode with + | FSC_DEBUG -> + cu + |> withDebug + |> withNoOptimize + |> ScriptRunner.runScriptFile langVersion + |> shouldSucceed + | FSC_OPTIMIZED -> + cu + |> withOptimize + |> withNoDebug + |> ScriptRunner.runScriptFile langVersion + |> shouldSucceed + | FSI -> + cu + |> ScriptRunner.runScriptFile langVersion + |> shouldSucceed + | COMPILED_EXE_APP -> + cu + |> withDefines ("TESTS_AS_APP" :: ScriptRunner.defaultDefines) + |> compileExeAndRun + |> shouldSucceed + | NEG_TEST_BUILD testName -> diffNegativeBaseline (cu |> withName mainFile) absFolder testName langVersion + + |> ignore + + + let singleTestBuildAndRunAux folder bonusArgs mode = singleTestBuildAndRunAuxVersion folder bonusArgs mode LangVersion.Latest + let singleTestBuildAndRunVersion folder mode version = singleTestBuildAndRunAuxVersion folder [] mode version + let singleTestBuildAndRun folder mode = singleTestBuildAndRunVersion folder mode LangVersion.Latest + + let singleVersionedNegTestAux folder bonusArgs version testName = + singleTestBuildAndRunAuxVersion folder bonusArgs (NEG_TEST_BUILD testName) version + let singleVersionedNegTest (folder:string) (version:LangVersion) (testName:string) = + singleVersionedNegTestAux folder [] version testName + let singleNegTest folder testName = singleVersionedNegTest folder LangVersion.Latest testName \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Miscellaneous/MigratedCoreTests.fs b/tests/FSharp.Compiler.ComponentTests/Miscellaneous/MigratedCoreTests.fs new file mode 100644 index 00000000000..fe4437af9c8 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Miscellaneous/MigratedCoreTests.fs @@ -0,0 +1,477 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +module FSharp.Compiler.ComponentTests.Miscellaneous.FsharpSuiteMigrated.CoreTests + +open Xunit +open FSharp.Test +open FSharp.Test.ScriptHelpers +open TestFrameworkAdapter + + +// These tests are enabled for .NET Framework and .NET Core +[] +let ``access-FSC_DEBUG``() = singleTestBuildAndRun "core/access" FSC_DEBUG + +[] +let ``access-FSC_OPTIMIZED``() = singleTestBuildAndRun "core/access" FSC_OPTIMIZED + +[] +let ``access-FSI``() = singleTestBuildAndRun "core/access" FSI + +[] +let ``apporder-FSC_DEBUG`` () = singleTestBuildAndRun "core/apporder" FSC_DEBUG + +[] +let ``apporder-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/apporder" FSC_OPTIMIZED + +[] +let ``apporder-FSI`` () = singleTestBuildAndRun "core/apporder" FSI + +[] +let ``array-FSC_DEBUG-5.0`` () = singleTestBuildAndRunVersion "core/array" FSC_DEBUG LangVersion.V50 + +[] +let ``array-FSC_OPTIMIZED-5.0`` () = singleTestBuildAndRunVersion "core/array" FSC_OPTIMIZED LangVersion.V50 + +[] +let ``array-FSI-5.0`` () = singleTestBuildAndRunVersion "core/array" FSI LangVersion.V50 + +[] +let ``array-FSC_OPTIMIZED-preview`` () = singleTestBuildAndRunVersion "core/array" FSC_OPTIMIZED LangVersion.Preview + +[] +let ``array-no-dot-FSC_DEBUG`` () = singleTestBuildAndRunVersion "core/array-no-dot" FSC_DEBUG LangVersion.Preview + +[] +let ``array-no-dot-FSC_OPTIMIZED`` () = singleTestBuildAndRunVersion "core/array-no-dot" FSC_OPTIMIZED LangVersion.Preview + +[] +let ``array-no-dot-FSI`` () = singleTestBuildAndRunVersion "core/array-no-dot" FSI LangVersion.Preview + +[] +let ``array-no-dot-warnings-langversion-default`` () = + singleVersionedNegTest "core/array-no-dot-warnings" LangVersion.Latest "test-langversion-default" + +[] +let ``array-no-dot-warnings-langversion-5_0`` () = + singleVersionedNegTest "core/array-no-dot-warnings" LangVersion.V50 "test-langversion-5.0" + +[] +let ``ref-ops-deprecation-langversion-preview`` () = + singleVersionedNegTest "core/ref-ops-deprecation" LangVersion.Preview "test-langversion-preview" + +[] +let ``auto-widen-version-5_0``() = + singleVersionedNegTest "core/auto-widen/5.0" LangVersion.V50 "test" + +[] +let ``auto-widen-version-FSC_DEBUG-preview``() = + singleTestBuildAndRunVersion "core/auto-widen/preview" FSC_DEBUG LangVersion.Preview + +[] +let ``auto-widen-version-FSC_OPTIMIZED-preview``() = + singleTestBuildAndRunVersion "core/auto-widen/preview" FSC_OPTIMIZED LangVersion.Preview + +[] +let ``auto-widen-minimal``() = + singleTestBuildAndRunVersion "core/auto-widen/minimal" FSC_OPTIMIZED LangVersion.V70 + +[] +let ``auto-widen-version-preview-warns-on``() = + singleVersionedNegTestAux "core/auto-widen/preview" ["--warnon:3388";"--warnon:3389";"--warnon:3395";"--warnaserror+";"--define:NEGATIVE"] LangVersion.Preview "test" + +[] +let ``auto-widen-version-preview-default-warns``() = + singleVersionedNegTestAux "core/auto-widen/preview-default-warns" ["--warnaserror+";"--define:NEGATIVE"] LangVersion.Preview "test" + +[] +let ``comprehensions-FSC_DEBUG`` () = singleTestBuildAndRun "core/comprehensions" FSC_DEBUG + +[] +let ``comprehensions-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/comprehensions" FSC_OPTIMIZED + +[] +let ``comprehensions-FSI`` () = singleTestBuildAndRun "core/comprehensions" FSI + +[] +let ``comprehensionshw-FSC_DEBUG`` () = singleTestBuildAndRun "core/comprehensions-hw" FSC_DEBUG + +[] +let ``comprehensionshw-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/comprehensions-hw" FSC_OPTIMIZED + +[] +let ``comprehensionshw-FSI`` () = singleTestBuildAndRun "core/comprehensions-hw" FSI + +[] +let ``genericmeasures-FSC_DEBUG`` () = singleTestBuildAndRun "core/genericmeasures" FSC_DEBUG + +[] +let ``genericmeasures-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/genericmeasures" FSC_OPTIMIZED + +[] +let ``genericmeasures-FSI`` () = singleTestBuildAndRun "core/genericmeasures" FSI + +[] +let ``innerpoly-FSC_DEBUG`` () = singleTestBuildAndRun "core/innerpoly" FSC_DEBUG + +[] +let ``innerpoly-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/innerpoly" FSC_OPTIMIZED + +[] +let ``innerpoly-FSI`` () = singleTestBuildAndRun "core/innerpoly" FSI + +[] +let ``namespaceAttributes-FSC_DEBUG`` () = singleTestBuildAndRun "core/namespaces" COMPILED_EXE_APP + +[] +let ``namespaceAttributes-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/namespaces" COMPILED_EXE_APP + +[] +let ``unicode2-FSC_DEBUG`` () = singleTestBuildAndRun "core/unicode" FSC_DEBUG // TODO: fails on coreclr + +[] +let ``unicode2-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/unicode" FSC_OPTIMIZED // TODO: fails on coreclr + +[] +let ``unicode2-FSI`` () = singleTestBuildAndRun "core/unicode" FSI + +[] +let ``lazy test-FSC_DEBUG`` () = singleTestBuildAndRun "core/lazy" FSC_DEBUG + +[] +let ``lazy test-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/lazy" FSC_OPTIMIZED + +[] +let ``lazy test-FSI`` () = singleTestBuildAndRun "core/lazy" FSI + +[] +let ``letrec-FSC_DEBUG`` () = singleTestBuildAndRun "core/letrec" FSC_DEBUG + +[] +let ``letrec-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/letrec" FSC_OPTIMIZED + +[] +let ``letrec-FSI`` () = singleTestBuildAndRun "core/letrec" FSI + +[] +let ``letrec (mutrec variations part one) FSC_DEBUG`` () = singleTestBuildAndRun "core/letrec-mutrec" FSC_DEBUG + +[] +let ``letrec (mutrec variations part one) FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/letrec-mutrec" FSC_OPTIMIZED + +[] +let ``letrec (mutrec variations part one) FSI`` () = singleTestBuildAndRun "core/letrec-mutrec" FSI + +[] +let ``libtest-FSC_DEBUG`` () = singleTestBuildAndRun "core/libtest" FSC_DEBUG + +[] +let ``libtest-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/libtest" FSC_OPTIMIZED + +[] +let ``libtest-FSI`` () = singleTestBuildAndRun "core/libtest" FSI + +[] +let ``lift-FSC_DEBUG`` () = singleTestBuildAndRun "core/lift" FSC_DEBUG + +[] +let ``lift-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/lift" FSC_OPTIMIZED + +[] +let ``lift-FSI`` () = singleTestBuildAndRun "core/lift" FSI + +[] +let ``map-FSC_DEBUG`` () = singleTestBuildAndRun "core/map" FSC_DEBUG + +[] +let ``map-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/map" FSC_OPTIMIZED + +[] +let ``map-FSI`` () = singleTestBuildAndRun "core/map" FSI + +[] +let ``measures-FSC_DEBUG`` () = singleTestBuildAndRun "core/measures" FSC_DEBUG + +[] +let ``measures-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/measures" FSC_OPTIMIZED + +[] +let ``measures-FSI`` () = singleTestBuildAndRun "core/measures" FSI + +[] +let ``nested-FSC_DEBUG`` () = singleTestBuildAndRun "core/nested" FSC_DEBUG + +[] +let ``nested-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/nested" FSC_OPTIMIZED + +[] +let ``nested-FSI`` () = singleTestBuildAndRun "core/nested" FSI + +[] +let ``members-basics-hw`` () = singleTestBuildAndRun "core/members/basics-hw" FSC_OPTIMIZED + +[] +let ``members-basics-hw-mutrec`` () = singleTestBuildAndRun "core/members/basics-hw-mutrec" FSC_OPTIMIZED + +[] +let ``members-incremental-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/members/incremental" FSC_OPTIMIZED + +[] +let ``members-incremental-FSI`` () = singleTestBuildAndRun "core/members/incremental" FSI + +[] +let ``members-incremental-hw-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/members/incremental-hw" FSC_OPTIMIZED + +[] +let ``members-incremental-hw-FSI`` () = singleTestBuildAndRun "core/members/incremental-hw" FSI + +[] +let ``members-incremental-hw-mutrec-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/members/incremental-hw-mutrec" FSC_OPTIMIZED + +[] +let ``members-ops-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/members/ops" FSC_OPTIMIZED + +[] +let ``members-ops-FSC_DEBUG`` () = singleTestBuildAndRun "core/members/ops" FSC_DEBUG + +[] +let ``members-ops-FSI`` () = singleTestBuildAndRun "core/members/ops" FSI + +[] +let ``members-ops-mutrec-FSC_DEBUG`` () = singleTestBuildAndRun "core/members/ops-mutrec" FSC_DEBUG + +[] +let ``members-ops-mutrec-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/members/ops-mutrec" FSC_OPTIMIZED + +[] +let ``members-ops-mutrec-FSI`` () = singleTestBuildAndRun "core/members/ops-mutrec" FSI + +[] +let ``seq-FSC_DEBUG`` () = singleTestBuildAndRun "core/seq" FSC_DEBUG + +[] +let ``seq-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/seq" FSC_OPTIMIZED + +[] +let ``seq-FSI`` () = singleTestBuildAndRun "core/seq" FSI + +[] +let ``math-numbers-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/math/numbers" FSC_OPTIMIZED + +[] +let ``math-numbers-FSI`` () = singleTestBuildAndRun "core/math/numbers" FSI + +[] +let ``members-ctree-FSC_DEBUG`` () = singleTestBuildAndRun "core/members/ctree" FSC_DEBUG + +[] +let ``members-ctree-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/members/ctree" FSC_OPTIMIZED + +[] +let ``members-ctree-FSI`` () = singleTestBuildAndRun "core/members/ctree" FSI + +[] +let ``members-factors-FSC_DEBUG`` () = singleTestBuildAndRun "core/members/factors" FSC_DEBUG + +[] +let ``members-factors-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/members/factors" FSC_OPTIMIZED + +[] +let ``members-factors-FSI`` () = singleTestBuildAndRun "core/members/factors" FSI + +[] +let ``members-factors-mutrec-FSC_DEBUG`` () = singleTestBuildAndRun "core/members/factors-mutrec" FSC_DEBUG + +[] +let ``members-factors-mutrec-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/members/factors-mutrec" FSC_OPTIMIZED + +[] +let ``members-factors-mutrec-FSI`` () = singleTestBuildAndRun "core/members/factors-mutrec" FSI + +[] +let ``graph-FSC_DEBUG`` () = singleTestBuildAndRunVersion "perf/graph" FSC_DEBUG LangVersion.SupportsMl + +[] +let ``graph-FSC_OPTIMIZED`` () = singleTestBuildAndRunVersion "perf/graph" FSC_OPTIMIZED LangVersion.SupportsMl + +[] +let ``graph-FSI`` () = singleTestBuildAndRunVersion "perf/graph" FSI LangVersion.SupportsMl + +[] +let ``nbody-FSC_DEBUG`` () = singleTestBuildAndRunVersion "perf/nbody" FSC_DEBUG LangVersion.SupportsMl + +[] +let ``nbody-FSC_OPTIMIZED`` () = singleTestBuildAndRunVersion "perf/nbody" FSC_OPTIMIZED LangVersion.SupportsMl + +[] +let ``nbody-FSI`` () = singleTestBuildAndRunVersion "perf/nbody" FSI LangVersion.SupportsMl + +[] +let ``forexpression-FSC_DEBUG`` () = singleTestBuildAndRun "core/forexpression" FSC_DEBUG + +[] +let ``forexpression-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/forexpression" FSC_OPTIMIZED + +[] +let ``forexpression-FSI`` () = singleTestBuildAndRun "core/forexpression" FSI + +[] +let ``letrec (mutrec variations part two) FSC_DEBUG`` () = singleTestBuildAndRun "core/letrec-mutrec2" FSC_DEBUG + +[] +let ``letrec (mutrec variations part two) FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/letrec-mutrec2" FSC_OPTIMIZED + +[] +let ``letrec (mutrec variations part two) FSI`` () = singleTestBuildAndRun "core/letrec-mutrec2" FSI + +[] +let ``printf`` () = singleTestBuildAndRunVersion "core/printf" FSC_OPTIMIZED LangVersion.Preview + +[] +let ``printf-interpolated`` () = singleTestBuildAndRunVersion "core/printf-interpolated" FSC_OPTIMIZED LangVersion.Preview + +[] +let ``tlr-FSC_DEBUG`` () = singleTestBuildAndRun "core/tlr" FSC_DEBUG + +[] +let ``tlr-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/tlr" FSC_OPTIMIZED + +[] +let ``tlr-FSI`` () = singleTestBuildAndRun "core/tlr" FSI + +[] +let ``subtype-FSC_DEBUG`` () = singleTestBuildAndRun "core/subtype" FSC_DEBUG + +[] +let ``subtype-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/subtype" FSC_OPTIMIZED + +[] +let ``subtype-FSI`` () = singleTestBuildAndRun "core/subtype" FSI + +[] +let ``syntax-FSC_DEBUG`` () = singleTestBuildAndRun "core/syntax" FSC_DEBUG + +[] +let ``syntax-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/syntax" FSC_OPTIMIZED + +[] +let ``syntax-FSI`` () = singleTestBuildAndRun "core/syntax" FSI + +[] +let ``test int32-FSC_DEBUG`` () = singleTestBuildAndRun "core/int32" FSC_DEBUG + +[] +let ``test int32-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/int32" FSC_OPTIMIZED + +[] +let ``test int32-FSI`` () = singleTestBuildAndRun "core/int32" FSI + +// This test stays in FsharpSuite for desktop framework for a later migration phases, it uses hardcoded #r to a C# compiled cslib.dll inside +[] +let ``quotes-FSC-FSC_DEBUG`` () = singleTestBuildAndRun "core/quotes" FSC_DEBUG + +[] +let ``quotes-FSC-BASIC`` () = singleTestBuildAndRun "core/quotes" FSC_OPTIMIZED + +[] +let ``quotes-FSI-BASIC`` () = singleTestBuildAndRun "core/quotes" FSI + +[] +let ``recordResolution-FSC_DEBUG`` () = singleTestBuildAndRun "core/recordResolution" FSC_DEBUG + +[] +let ``recordResolution-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/recordResolution" FSC_OPTIMIZED + +[] +let ``recordResolution-FSI`` () = singleTestBuildAndRun "core/recordResolution" FSI + +// This test has hardcoded expectations about current synchronization context +// Will be moved out of FsharpSuite.Tests in a later phase for desktop framework +[] +let ``control-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/control" FSC_OPTIMIZED + +[] +let ``control-FSI`` () = singleTestBuildAndRun "core/control" FSI + +[] +let ``control --tailcalls`` () = + let cfg = "core/control" + singleTestBuildAndRunAux cfg ["--tailcalls"] FSC_OPTIMIZED + +[] +let ``controlChamenos-FSC_OPTIMIZED`` () = + let cfg = "core/controlChamenos" + singleTestBuildAndRunAux cfg ["--tailcalls"] FSC_OPTIMIZED + +[] +let ``controlChamenos-FSI`` () = + let cfg = "core/controlChamenos" + singleTestBuildAndRunAux cfg ["--tailcalls"] FSI + +[] +let ``controlMailbox-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/controlMailbox" FSC_OPTIMIZED + +[] +let ``controlMailbox-FSI`` () = singleTestBuildAndRun "core/controlMailbox" FSI + +[] +let ``controlMailbox --tailcalls`` () = + let cfg = "core/controlMailbox" + singleTestBuildAndRunAux cfg ["--tailcalls"] FSC_OPTIMIZED + +[] +let ``csext-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/csext" FSC_OPTIMIZED + +[] +let ``csext-FSI`` () = singleTestBuildAndRun "core/csext" FSI + +[] +let ``enum-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/enum" FSC_OPTIMIZED + +[] +let ``enum-FSI`` () = singleTestBuildAndRun "core/enum" FSI + +[] +let ``longnames-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/longnames" FSC_OPTIMIZED + +[] +let ``longnames-FSI`` () = singleTestBuildAndRun "core/longnames" FSI + +[] +let ``math-numbersVS2008-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/math/numbersVS2008" FSC_OPTIMIZED + +[] +let ``math-numbersVS2008-FSI`` () = singleTestBuildAndRun "core/math/numbersVS2008" FSI + +[] +let ``patterns-FSC_OPTIMIZED`` () = singleTestBuildAndRunVersion "core/patterns" FSC_OPTIMIZED LangVersion.Preview + +// This requires --multiemit on by default, which is not the case for .NET Framework +[] +let ``patterns-FSI`` () = singleTestBuildAndRun "core/patterns" FSI + +[] +let ``fsi_load-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/fsi-load" FSC_OPTIMIZED + +[] +let ``fsi_load-FSI`` () = singleTestBuildAndRun "core/fsi-load" FSI + +[] +let ``reflect-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/reflect" FSC_OPTIMIZED + +[] +let ``reflect-FSI`` () = singleTestBuildAndRun "core/reflect" FSI + +module PInvokeTests = + open System.Runtime.InteropServices + let isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) + + [] + let ``pinvoke-FSC_OPTIMIZED`` () = + if isWindows then + singleTestBuildAndRun "core/pinvoke" FSC_OPTIMIZED + + [] + let ``pinvoke-FSI`` () = + if isWindows then + singleTestBuildAndRun "core/pinvoke" FSI \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Miscellaneous/MigratedOverloadTests.fs b/tests/FSharp.Compiler.ComponentTests/Miscellaneous/MigratedOverloadTests.fs new file mode 100644 index 00000000000..55286a6a656 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Miscellaneous/MigratedOverloadTests.fs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +module FSharp.Compiler.ComponentTests.Miscellaneous.FsharpSuiteMigrated.OverloadResolution + +open Xunit +open FSharp.Test +open TestFrameworkAdapter + +module ``fsharpqa migrated tests`` = + let [] ``Conformance\Expressions\SyntacticSugar (E_Slices01_fs)`` () = singleNegTest ( "conformance/expressions/syntacticsugar") "E_Slices01" + let [] ``Conformance\Expressions\Type-relatedExpressions (E_RigidTypeAnnotation03_fsx)`` () = singleNegTest ( "conformance/expressions/type-relatedexpressions") "E_RigidTypeAnnotation03" + let [] ``Conformance\Inference (E_OneTypeVariable03_fs)`` () = singleNegTest ( "conformance/inference") "E_OneTypeVariable03" + let [] ``Conformance\Inference (E_OneTypeVariable03rec_fs)`` () = singleNegTest ( "conformance/inference") "E_OneTypeVariable03rec" + let [] ``Conformance\Inference (E_TwoDifferentTypeVariablesGen00_fs)`` () = singleNegTest ( "conformance/inference") "E_TwoDifferentTypeVariablesGen00" + let [] ``Conformance\Inference (E_TwoDifferentTypeVariables01_fs)`` () = singleNegTest ( "conformance/inference") "E_TwoDifferentTypeVariables01" + let [] ``Conformance\Inference (E_TwoDifferentTypeVariables01rec_fs)`` () = singleNegTest ( "conformance/inference") "E_TwoDifferentTypeVariables01rec" + let [] ``Conformance\Inference (E_TwoDifferentTypeVariablesGen00rec_fs)`` () = singleNegTest ( "conformance/inference") "E_TwoDifferentTypeVariablesGen00rec" + let [] ``Conformance\Inference (E_TwoEqualTypeVariables02_fs)`` () = singleNegTest ( "conformance/inference") "E_TwoEqualTypeVariables02" + let [] ``Conformance\Inference (E_TwoEqualYypeVariables02rec_fs)`` () = singleNegTest ( "conformance/inference") "E_TwoEqualYypeVariables02rec" + let [] ``Conformance\Inference (E_LeftToRightOverloadResolution01_fs)`` () = singleNegTest ( "conformance/inference") "E_LeftToRightOverloadResolution01" + let [] ``Conformance\WellFormedness (E_Clashing_Values_in_AbstractClass01_fs)`` () = singleNegTest ( "conformance/wellformedness") "E_Clashing_Values_in_AbstractClass01" + let [] ``Conformance\WellFormedness (E_Clashing_Values_in_AbstractClass03_fs)`` () = singleNegTest ( "conformance/wellformedness") "E_Clashing_Values_in_AbstractClass03" + let [] ``Conformance\WellFormedness (E_Clashing_Values_in_AbstractClass04_fs)`` () = singleNegTest ( "conformance/wellformedness") "E_Clashing_Values_in_AbstractClass04" + // note: this test still exist in fsharpqa to assert the compiler doesn't crash + // the part of the code generating a flaky error due to https://github.com/dotnet/fsharp/issues/6725 + // is elided here to focus on overload resolution error messages + let [] ``Conformance\LexicalAnalysis\SymbolicOperators (E_LessThanDotOpenParen001_fs)`` () = singleNegTest ( "conformance/lexicalanalysis") "E_LessThanDotOpenParen001" + +module ``error messages using BCL``= + let [] ``neg_System_Convert_ToString_OverloadList``() = singleNegTest ( "typecheck/overloads") "neg_System.Convert.ToString.OverloadList" + let [] ``neg_System_Threading_Tasks_Task_Run_OverloadList``() = singleNegTest ( "typecheck/overloads") "neg_System.Threading.Tasks.Task.Run.OverloadList" + let [] ``neg_System_Drawing_Graphics_DrawRectangleOverloadList_fsx``() = singleNegTest ( "typecheck/overloads") "neg_System.Drawing.Graphics.DrawRectangleOverloadList" + +module ``ad hoc code overload error messages``= + let [] ``neg_many_many_overloads`` () = singleNegTest ( "typecheck/overloads") "neg_many_many_overloads" + let [] ``neg_interface_generics`` () = singleNegTest ( "typecheck/overloads") "neg_interface_generics" + let [] ``neg_known_return_type_and_known_type_arguments`` () = singleNegTest ( "typecheck/overloads") "neg_known_return_type_and_known_type_arguments" + let [] ``neg_generic_known_argument_types`` () = singleNegTest ( "typecheck/overloads") "neg_generic_known_argument_types" + let [] ``neg_tupled_arguments`` () = singleNegTest ( "typecheck/overloads") "neg_tupled_arguments" \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Miscellaneous/MigratedTypeCheckTests.fs b/tests/FSharp.Compiler.ComponentTests/Miscellaneous/MigratedTypeCheckTests.fs new file mode 100644 index 00000000000..09a287838b3 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Miscellaneous/MigratedTypeCheckTests.fs @@ -0,0 +1,501 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +module FSharp.Compiler.ComponentTests.Miscellaneous.FsharpSuiteMigrated.TypeCheckTests + +open Xunit +open FSharp.Test +open FSharp.Test.ScriptHelpers +open TestFrameworkAdapter + +[] +let misc () = singleTestBuildAndRunVersion "typecheck/misc" FSC_OPTIMIZED LangVersion.SupportsMl + +[] +let ``type check neg01`` () = singleNegTest ( "typecheck/sigs") "neg01" + +[] +let ``type check neg02`` () = singleVersionedNegTest ( "typecheck/sigs") LangVersion.V60 "neg02" + +[] +let ``type check neg03`` () = singleVersionedNegTest ( "typecheck/sigs") LangVersion.SupportsMl "neg03" + +[] +let ``type check neg04`` () = singleNegTest ( "typecheck/sigs") "neg04" + +[] +let ``type check neg05`` () = singleNegTest ( "typecheck/sigs") "neg05" + +[] +let ``type check neg06`` () = singleNegTest ( "typecheck/sigs") "neg06" + +[] +let ``type check neg06_a`` () = singleNegTest ( "typecheck/sigs") "neg06_a" + +[] +let ``type check neg06_b`` () = singleNegTest ( "typecheck/sigs") "neg06_b" + +[] +let ``type check neg07`` () = singleNegTest ( "typecheck/sigs") "neg07" + +[] +let ``type check neg08`` () = singleNegTest ( "typecheck/sigs") "neg08" + +[] +let ``type check neg09`` () = singleNegTest ( "typecheck/sigs") "neg09" + +[] +let ``type check neg10`` () = singleNegTest ( "typecheck/sigs") "neg10" + +[] +let ``type check neg10_a`` () = singleNegTest ( "typecheck/sigs") "neg10_a" + +[] +let ``type check neg11`` () = singleNegTest ( "typecheck/sigs") "neg11" + +[] +let ``type check neg12`` () = singleNegTest ( "typecheck/sigs") "neg12" + +[] +let ``type check neg13`` () = singleNegTest ( "typecheck/sigs") "neg13" + +[] +let ``type check neg14`` () = singleNegTest ( "typecheck/sigs") "neg14" + +[] +let ``type check neg15`` () = singleNegTest ( "typecheck/sigs") "neg15" + +[] +let ``type check neg16`` () = singleNegTest ( "typecheck/sigs") "neg16" + +[] +let ``type check neg17`` () = singleNegTest ( "typecheck/sigs") "neg17" + +[] +let ``type check neg18`` () = singleNegTest ( "typecheck/sigs") "neg18" + +[] +let ``type check neg19`` () = singleNegTest ( "typecheck/sigs") "neg19" + +[] +let ``type check neg20`` () = singleNegTest ( "typecheck/sigs") "neg20" + +[] +let ``type check neg20 version 5_0`` () = + let cfg = "typecheck/sigs/version50" + singleVersionedNegTest cfg LangVersion.V50 "neg20" + +[] +let ``type check neg21`` () = singleNegTest ( "typecheck/sigs") "neg21" + +[] +let ``type check neg23`` () = singleNegTest ( "typecheck/sigs") "neg23" + + +[] +let ``type check neg25`` () = singleNegTest ( "typecheck/sigs") "neg25" + +[] +let ``type check neg26`` () = singleNegTest ( "typecheck/sigs") "neg26" + +[] +let ``type check neg27`` () = singleNegTest ( "typecheck/sigs") "neg27" + +[] +let ``type check neg28`` () = singleNegTest ( "typecheck/sigs") "neg28" + +[] +let ``type check neg29`` () = singleNegTest ( "typecheck/sigs") "neg29" + +[] +let ``type check neg30`` () = singleNegTest ( "typecheck/sigs") "neg30" + +[] +let ``type check neg31`` () = singleNegTest ( "typecheck/sigs") "neg31" + +[] +let ``type check neg32`` () = singleNegTest ( "typecheck/sigs") "neg32" + +[] +let ``type check neg33`` () = singleNegTest ( "typecheck/sigs") "neg33" + +[] +let ``type check neg34`` () = singleNegTest ( "typecheck/sigs") "neg34" + +[] +let ``type check neg35`` () = singleNegTest ( "typecheck/sigs") "neg35" + +[] +let ``type check neg36`` () = singleNegTest ( "typecheck/sigs") "neg36" + +[] +let ``type check neg37`` () = singleNegTest ( "typecheck/sigs") "neg37" + +[] +let ``type check neg37_a`` () = singleNegTest ( "typecheck/sigs") "neg37_a" + +[] +let ``type check neg38`` () = singleNegTest ( "typecheck/sigs") "neg38" + +[] +let ``type check neg39`` () = singleNegTest ( "typecheck/sigs") "neg39" + +[] +let ``type check neg40`` () = singleNegTest ( "typecheck/sigs") "neg40" + +[] +let ``type check neg41`` () = singleNegTest ( "typecheck/sigs") "neg41" + +[] +let ``type check neg42`` () = singleNegTest ( "typecheck/sigs") "neg42" + +[] +let ``type check neg43`` () = singleNegTest ( "typecheck/sigs") "neg43" + +[] +let ``type check neg44`` () = singleNegTest ( "typecheck/sigs") "neg44" + +#if !DEBUG // requires release version of compiler to avoid very deep stacks +[] +let ``type check neg45`` () = singleNegTest ( "typecheck/sigs") "neg45" +#endif + +[] +let ``type check neg46`` () = singleNegTest ( "typecheck/sigs") "neg46" + +[] +let ``type check neg47`` () = singleNegTest ( "typecheck/sigs") "neg47" + +[] +let ``type check neg48`` () = singleNegTest ( "typecheck/sigs") "neg48" + +[] +let ``type check neg49`` () = singleNegTest ( "typecheck/sigs") "neg49" + +[] +let ``type check neg50`` () = singleNegTest ( "typecheck/sigs") "neg50" + +[] +let ``type check neg51`` () = singleNegTest ( "typecheck/sigs") "neg51" + +[] +let ``type check neg52`` () = singleNegTest ( "typecheck/sigs") "neg52" + +[] +let ``type check neg53`` () = singleNegTest ( "typecheck/sigs") "neg53" + +[] +let ``type check neg54`` () = singleNegTest ( "typecheck/sigs") "neg54" + +[] +let ``type check neg55`` () = singleNegTest ( "typecheck/sigs") "neg55" + +[] +let ``type check neg56`` () = singleNegTest ( "typecheck/sigs") "neg56" + +[] +let ``type check neg56_a`` () = singleNegTest ( "typecheck/sigs") "neg56_a" + +[] +let ``type check neg56_b`` () = singleNegTest ( "typecheck/sigs") "neg56_b" + +[] +let ``type check neg57`` () = singleNegTest ( "typecheck/sigs") "neg57" + +[] +let ``type check neg58`` () = singleNegTest ( "typecheck/sigs") "neg58" + +[] +let ``type check neg59`` () = singleNegTest ( "typecheck/sigs") "neg59" + +[] +let ``type check neg60`` () = singleNegTest ( "typecheck/sigs") "neg60" + +[] +let ``type check neg61`` () = singleNegTest ( "typecheck/sigs") "neg61" + +[] +let ``type check neg62`` () = singleNegTest ( "typecheck/sigs") "neg62" + +[] +let ``type check neg63`` () = singleNegTest ( "typecheck/sigs") "neg63" + +[] +let ``type check neg64`` () = singleNegTest ( "typecheck/sigs") "neg64" + +[] +let ``type check neg65`` () = singleNegTest ( "typecheck/sigs") "neg65" + +[] +let ``type check neg66`` () = singleNegTest ( "typecheck/sigs") "neg66" + +[] +let ``type check neg67`` () = singleNegTest ( "typecheck/sigs") "neg67" + +[] +let ``type check neg68`` () = singleNegTest ( "typecheck/sigs") "neg68" + +[] +let ``type check neg69`` () = singleNegTest ( "typecheck/sigs") "neg69" + +[] +let ``type check neg70`` () = singleNegTest ( "typecheck/sigs") "neg70" + +[] +let ``type check neg71`` () = singleNegTest ( "typecheck/sigs") "neg71" + +[] +let ``type check neg72`` () = singleNegTest ( "typecheck/sigs") "neg72" + +[] +let ``type check neg73`` () = singleNegTest ( "typecheck/sigs") "neg73" + +[] +let ``type check neg74`` () = singleNegTest ( "typecheck/sigs") "neg74" + +[] +let ``type check neg75`` () = singleNegTest ( "typecheck/sigs") "neg75" + +[] +let ``type check neg76`` () = singleNegTest ( "typecheck/sigs") "neg76" + +[] +let ``type check neg77`` () = singleNegTest ( "typecheck/sigs") "neg77" + +[] +let ``type check neg78`` () = singleNegTest ( "typecheck/sigs") "neg78" + +[] +let ``type check neg79`` () = singleNegTest ( "typecheck/sigs") "neg79" + +[] +let ``type check neg80`` () = singleNegTest ( "typecheck/sigs") "neg80" + +[] +let ``type check neg81`` () = singleNegTest ( "typecheck/sigs") "neg81" + +[] +let ``type check neg82`` () = singleNegTest ( "typecheck/sigs") "neg82" + +[] +let ``type check neg83`` () = singleNegTest ( "typecheck/sigs") "neg83" + +[] +let ``type check neg84`` () = singleNegTest ( "typecheck/sigs") "neg84" + +[] +let ``type check neg85`` () = singleNegTest ( "typecheck/sigs") "neg85" + +[] +let ``type check neg86`` () = singleNegTest ( "typecheck/sigs") "neg86" + +[] +let ``type check neg88`` () = singleNegTest ( "typecheck/sigs") "neg88" + +[] +let ``type check neg89`` () = singleNegTest ( "typecheck/sigs") "neg89" + +[] +let ``type check neg90`` () = singleNegTest ( "typecheck/sigs") "neg90" + +[] +let ``type check neg91`` () = singleNegTest ( "typecheck/sigs") "neg91" + +[] +let ``type check neg92`` () = singleNegTest ( "typecheck/sigs") "neg92" + +[] +let ``type check neg93`` () = singleNegTest ( "typecheck/sigs") "neg93" + +[] +let ``type check neg94`` () = singleNegTest ( "typecheck/sigs") "neg94" + +[] +let ``type check neg95`` () = singleNegTest ( "typecheck/sigs") "neg95" + +[] +let ``type check neg96`` () = singleNegTest ( "typecheck/sigs") "neg96" + +[] +let ``type check neg97`` () = singleNegTest ( "typecheck/sigs") "neg97" + +[] +let ``type check neg98`` () = singleNegTest ( "typecheck/sigs") "neg98" + +[] +let ``type check neg99`` () = singleNegTest ( "typecheck/sigs") "neg99" + +[] +let ``type check neg100`` () = singleVersionedNegTestAux "typecheck/sigs" ["--warnon:3218" ] LangVersion.Latest "neg100" + +[] +let ``type check neg101`` () = singleNegTest ( "typecheck/sigs") "neg101" + +[] +let ``type check neg102`` () = singleNegTest ( "typecheck/sigs") "neg102" + +[] +let ``type check neg103`` () = singleNegTest ( "typecheck/sigs") "neg103" + +[] +let ``type check neg104`` () = singleNegTest ( "typecheck/sigs") "neg104" + +[] +let ``type check neg106`` () = singleNegTest ( "typecheck/sigs") "neg106" + +[] +let ``type check neg107`` () = singleNegTest ( "typecheck/sigs") "neg107" + +[] +let ``type check neg108`` () = singleNegTest ( "typecheck/sigs") "neg108" + +[] +let ``type check neg109`` () = singleNegTest ( "typecheck/sigs") "neg109" + +[] +let ``type check neg110`` () = singleNegTest ( "typecheck/sigs") "neg110" + +[] +let ``type check neg111`` () = singleNegTest ( "typecheck/sigs") "neg111" + +[] +let ``type check neg112`` () = singleNegTest ( "typecheck/sigs") "neg112" + +[] +let ``type check neg113`` () = singleNegTest ( "typecheck/sigs") "neg113" + +[] +let ``type check neg114`` () = singleNegTest ( "typecheck/sigs") "neg114" + +[] +let ``type check neg115`` () = singleNegTest ( "typecheck/sigs") "neg115" + +[] +let ``type check neg116`` () = singleNegTest ( "typecheck/sigs") "neg116" + +[] +let ``type check neg117`` () = singleNegTest ( "typecheck/sigs") "neg117" + +[] +let ``type check neg118`` () = singleNegTest ( "typecheck/sigs") "neg118" + +[] +let ``type check neg119a`` () = singleVersionedNegTest ( "typecheck/sigs") LangVersion.V60 "neg119a" + +[] +let ``type check neg119b`` () = singleVersionedNegTest ( "typecheck/sigs") LangVersion.V70 "neg119b" + +[] +let ``type check neg120`` () = singleNegTest ( "typecheck/sigs") "neg120" + +[] +let ``type check neg121`` () = singleNegTest ( "typecheck/sigs") "neg121" + +[] +let ``type check neg122`` () = singleNegTest ( "typecheck/sigs") "neg122" + +[] +let ``type check neg123`` () = singleNegTest ( "typecheck/sigs") "neg123" + +[] +let ``type check neg124`` () = singleNegTest ( "typecheck/sigs") "neg124" + +[] +let ``type check neg125`` () = singleNegTest ( "typecheck/sigs") "neg125" + +[] +let ``type check neg126`` () = singleNegTest ( "typecheck/sigs") "neg126" + +[] +let ``type check neg127`` () = singleNegTest ( "typecheck/sigs") "neg127" + +[] +let ``type check neg128`` () = singleNegTest ( "typecheck/sigs") "neg128" + +[] +let ``type check neg129`` () = singleNegTest ( "typecheck/sigs") "neg129" + +[] +let ``type check neg130`` () = singleNegTest ( "typecheck/sigs") "neg130" + +[] +let ``type check neg131`` () = singleVersionedNegTest ( "typecheck/sigs") LangVersion.V60 "neg131" + +[] +let ``type check neg132`` () = singleVersionedNegTest ( "typecheck/sigs") LangVersion.V50 "neg132" + +[] +let ``type check neg133`` () = singleNegTest ( "typecheck/sigs") "neg133" + +[] +let ``type check neg_anon_1`` () = singleNegTest ( "typecheck/sigs") "neg_anon_1" + +[] +let ``type check neg_anon_2`` () = singleNegTest ( "typecheck/sigs") "neg_anon_2" + +[] +let ``type check neg_issue_3752`` () = singleNegTest ( "typecheck/sigs") "neg_issue_3752" + +[] +let ``type check neg_byref_1`` () = singleNegTest ( "typecheck/sigs") "neg_byref_1" + +[] +let ``type check neg_byref_2`` () = singleNegTest ( "typecheck/sigs") "neg_byref_2" + +[] +let ``type check neg_byref_3`` () = singleNegTest ( "typecheck/sigs") "neg_byref_3" + +[] +let ``type check neg_byref_4`` () = singleNegTest ( "typecheck/sigs") "neg_byref_4" + +[] +let ``type check neg_byref_5`` () = singleNegTest ( "typecheck/sigs") "neg_byref_5" + +[] +let ``type check neg_byref_6`` () = singleNegTest ( "typecheck/sigs") "neg_byref_6" + +[] +let ``type check neg_byref_7`` () = singleNegTest ( "typecheck/sigs") "neg_byref_7" + +[] +let ``type check neg_byref_8`` () = singleNegTest ( "typecheck/sigs") "neg_byref_8" + +[] +let ``type check neg_byref_10`` () = singleNegTest ( "typecheck/sigs") "neg_byref_10" + +[] +let ``type check neg_byref_11`` () = singleNegTest ( "typecheck/sigs") "neg_byref_11" + +[] +let ``type check neg_byref_12`` () = singleNegTest ( "typecheck/sigs") "neg_byref_12" + +[] +let ``type check neg_byref_13`` () = singleNegTest ( "typecheck/sigs") "neg_byref_13" + +[] +let ``type check neg_byref_14`` () = singleNegTest ( "typecheck/sigs") "neg_byref_14" + +[] +let ``type check neg_byref_15`` () = singleNegTest ( "typecheck/sigs") "neg_byref_15" + +[] +let ``type check neg_byref_16`` () = singleNegTest ( "typecheck/sigs") "neg_byref_16" + +[] +let ``type check neg_byref_17`` () = singleNegTest ( "typecheck/sigs") "neg_byref_17" + +[] +let ``type check neg_byref_18`` () = singleNegTest ( "typecheck/sigs") "neg_byref_18" + +[] +let ``type check neg_byref_19`` () = singleNegTest ( "typecheck/sigs") "neg_byref_19" + +[] +let ``type check neg_byref_20`` () = singleNegTest ( "typecheck/sigs") "neg_byref_20" + +[] +let ``type check neg_byref_21`` () = singleNegTest ( "typecheck/sigs") "neg_byref_21" + +[] +let ``type check neg_byref_22`` () = singleNegTest ( "typecheck/sigs") "neg_byref_22" + +[] +let ``type check neg_byref_23`` () = singleNegTest ( "typecheck/sigs") "neg_byref_23" \ No newline at end of file diff --git a/tests/FSharp.Test.Utilities/Assert.fs b/tests/FSharp.Test.Utilities/Assert.fs index 41af78c735d..dfed4bf123e 100644 --- a/tests/FSharp.Test.Utilities/Assert.fs +++ b/tests/FSharp.Test.Utilities/Assert.fs @@ -3,6 +3,8 @@ namespace FSharp.Test module Assert = open FluentAssertions open System.Collections + open System.Text + open System.IO let inline shouldBeEqualWith (expected : ^T) (message: string) (actual: ^U) = actual.Should().BeEquivalentTo(expected, message) |> ignore @@ -24,3 +26,41 @@ module Assert = let shouldBeTrue (actual: bool) = actual.Should().BeTrue("") |> ignore + + let shouldBeSameMultilineStringSets expectedText actualText = + + let getLines text = + use reader = new StringReader(text) + Seq.initInfinite (fun _ -> reader.ReadLine()) + |> Seq.takeWhile (not << isNull) + |> set + let actual = getLines actualText + let expected = getLines expectedText + + let unexpectedlyMissing = Set.difference expected actual + let unexpectedlyPresent = Set.difference actual expected + + // If both sets are empty, the surface areas match so allow the test to pass. + if Set.isEmpty unexpectedlyMissing + && Set.isEmpty unexpectedlyPresent then + None + else + let msg = + let inline newLine (sb : System.Text.StringBuilder) = sb.AppendLine () |> ignore + let sb = System.Text.StringBuilder () + sb.Append "Unexpectedly missing (expected, not actual):" |> ignore + for s in unexpectedlyMissing do + newLine sb + sb.Append " " |> ignore + sb.Append s |> ignore + newLine sb + newLine sb + sb.Append "Unexpectedly present (actual, not expected):" |> ignore + for s in unexpectedlyPresent do + newLine sb + sb.Append " " |> ignore + sb.Append s |> ignore + newLine sb + sb.ToString () + + Some msg diff --git a/tests/FSharp.Test.Utilities/Compiler.fs b/tests/FSharp.Test.Utilities/Compiler.fs index 0eaa71a6348..19eca28eb29 100644 --- a/tests/FSharp.Test.Utilities/Compiler.fs +++ b/tests/FSharp.Test.Utilities/Compiler.fs @@ -145,7 +145,9 @@ module rec Compiler = type ErrorInfo = { Error: ErrorType Range: Range - Message: string } + NativeRange : FSharp.Compiler.Text.range + Message: string + SubCategory: string } type ExecutionOutput = { ExitCode: int @@ -156,13 +158,16 @@ module rec Compiler = | EvalOutput of Result | ExecutionOutput of ExecutionOutput + type SourceCodeFileName = string + type CompilationOutput = - { OutputPath: string option - Dependencies: string list - Adjust: int - Diagnostics: ErrorInfo list - Output: RunOutput option - Compilation: CompilationUnit } + { OutputPath: string option + Dependencies: string list + Adjust: int + Diagnostics: ErrorInfo list + PerFileErrors: (SourceCodeFileName * ErrorInfo) list + Output: RunOutput option + Compilation: CompilationUnit } [] type CompilationResult = @@ -219,14 +224,21 @@ module rec Compiler = References = [] } - let private fromFSharpDiagnostic (errors: FSharpDiagnostic[]) : ErrorInfo list = - let toErrorInfo (e: FSharpDiagnostic) : ErrorInfo = + let private fromFSharpDiagnostic (errors: FSharpDiagnostic[]) : (SourceCodeFileName * ErrorInfo) list = + let toErrorInfo (e: FSharpDiagnostic) : SourceCodeFileName * ErrorInfo = let errorNumber = e.ErrorNumber let severity = e.Severity - - let error = if severity = FSharpDiagnosticSeverity.Warning then Warning errorNumber else Error errorNumber - + let error = + match severity with + | FSharpDiagnosticSeverity.Warning -> Warning errorNumber + | FSharpDiagnosticSeverity.Error -> Error errorNumber + | FSharpDiagnosticSeverity.Info -> Information errorNumber + | FSharpDiagnosticSeverity.Hidden -> Hidden errorNumber + + e.FileName |> Path.GetFileName, { Error = error + NativeRange = e.Range + SubCategory = e.Subcategory Range = { StartLine = e.StartLine StartColumn = e.StartColumn @@ -236,7 +248,7 @@ module rec Compiler = errors |> List.ofArray - |> List.distinctBy (fun e -> e.Severity, e.ErrorNumber, e.StartLine, e.StartColumn, e.EndLine, e.EndColumn, e.Message) + |> List.distinctBy (fun e -> e.FileName,e.Severity, e.ErrorNumber, e.StartLine, e.StartColumn, e.EndLine, e.EndColumn, e.Message) |> List.map toErrorInfo let private partitionErrors diagnostics = diagnostics |> List.partition (fun e -> match e.Error with Error _ -> true | _ -> false) @@ -246,7 +258,7 @@ module rec Compiler = let private getWarnings diagnostics = diagnostics |> List.filter (fun e -> match e.Error with Warning _ -> true | _ -> false) let private adjustRange (range: Range) (adjust: int) : Range = - { + { range with StartLine = range.StartLine - adjust StartColumn = range.StartColumn + 1 EndLine = range.EndLine - adjust @@ -409,14 +421,14 @@ module rec Compiler = let withLangVersionPreview (cUnit: CompilationUnit) : CompilationUnit = withOptionsHelper [ "--langversion:preview" ] "withLangVersionPreview is only supported on F#" cUnit - + let withLangVersion (version: string) (cUnit: CompilationUnit) : CompilationUnit = withOptionsHelper [ $"--langversion:{version}" ] "withLangVersion is only supported on F#" cUnit let withAssemblyVersion (version:string) (cUnit: CompilationUnit) : CompilationUnit = withOptionsHelper [ $"--version:{version}" ] "withAssemblyVersion is only supported on F#" cUnit - let withWarnOn (warning : int) (cUnit: CompilationUnit) : CompilationUnit = + let withWarnOn (cUnit: CompilationUnit) warning : CompilationUnit = withOptionsHelper [ $"--warnon:{warning}" ] "withWarnOn is only supported for F#" cUnit let withNoWarn warning (cUnit: CompilationUnit) : CompilationUnit = @@ -575,14 +587,15 @@ module rec Compiler = let diagnostics = err |> fromFSharpDiagnostic let result = - { OutputPath = None - Dependencies = deps - Adjust = 0 - Diagnostics = diagnostics - Output = None - Compilation = cUnit } + { OutputPath = None + Dependencies = deps + Adjust = 0 + PerFileErrors = diagnostics + Diagnostics = diagnostics |> List.map snd + Output = None + Compilation = cUnit } - let (errors, warnings) = partitionErrors diagnostics + let (errors, warnings) = partitionErrors result.Diagnostics // Treat warnings as errors if "IgnoreWarnings" is false if errors.Length > 0 || (warnings.Length > 0 && not ignoreWarnings) then @@ -619,6 +632,8 @@ module rec Compiler = StartColumn = span.Start.Character EndLine = span.End.Line EndColumn = span.End.Character } + NativeRange = Unchecked.defaultof<_> + SubCategory = "" Message = d.GetMessage() } let private compileCSharpCompilation (compilation: CSharpCompilation) csSource (filePath : string) dependencies : CompilationResult = @@ -628,6 +643,7 @@ module rec Compiler = Dependencies = dependencies Adjust = 0 Diagnostics = cmplResult.Diagnostics |> Seq.map toErrorInfo |> Seq.toList + PerFileErrors= List.empty // Not needed for C# testing for now. Implement when needed Output = None Compilation = CS csSource } @@ -727,7 +743,8 @@ module rec Compiler = { OutputPath = None Dependencies = [] Adjust = 0 - Diagnostics = diagnostics + Diagnostics = diagnostics |> List.map snd + PerFileErrors= diagnostics Output = None Compilation = FS fsSource } @@ -757,10 +774,11 @@ module rec Compiler = { OutputPath = None Dependencies = [] Adjust = 0 - Diagnostics = diagnostics + Diagnostics = diagnostics |> List.map snd + PerFileErrors= diagnostics Output = None Compilation = FS fsSource } - let (errors, warnings) = partitionErrors diagnostics + let (errors, warnings) = partitionErrors result.Diagnostics // Treat warnings as errors if "IgnoreWarnings" is false; if errors.Length > 0 || (warnings.Length > 0 && not fsSource.IgnoreWarnings) then @@ -806,24 +824,41 @@ module rec Compiler = let compileExeAndRun = asExe >> compileAndRun - let private evalFSharp (fs: FSharpCompilationSource) (script:FSharpScript) : CompilationResult = - let source = fs.Source.GetSourceText |> Option.defaultValue "" - let (evalResult: Result), (err: FSharpDiagnostic[]) = script.Eval(source) - let diagnostics = err |> fromFSharpDiagnostic + let private processScriptResults fs (evalResult: Result, err: FSharpDiagnostic[]) = + let perFileDiagnostics = err |> fromFSharpDiagnostic + let diagnostics = perFileDiagnostics |> List.map snd + let (errors, warnings) = partitionErrors diagnostics let result = { OutputPath = None Dependencies = [] Adjust = 0 - Diagnostics = diagnostics + Diagnostics = if fs.IgnoreWarnings then errors else diagnostics + PerFileErrors = perFileDiagnostics Output = Some (EvalOutput evalResult) Compilation = FS fs } - - let (errors, warnings) = partitionErrors diagnostics + let evalError = match evalResult with Ok _ -> false | _ -> true - if evalError || errors.Length > 0 || (warnings.Length > 0 && not fs.IgnoreWarnings) then + if evalError || errors.Length > 0 || (warnings.Length > 0 && not fs.IgnoreWarnings) then CompilationResult.Failure result else CompilationResult.Success result + + + let private evalFSharp (fs: FSharpCompilationSource) (script:FSharpScript) : CompilationResult = + let source = fs.Source.GetSourceText |> Option.defaultValue "" + script.Eval(source) |> (processScriptResults fs) + + let scriptingShim = Path.Combine(__SOURCE_DIRECTORY__,"ScriptingShims.fsx") + let private evalScriptFromDisk (fs: FSharpCompilationSource) (script:FSharpScript) : CompilationResult = + + let fileNames = + (fs.Source :: fs.AdditionalSources) + |> List.map (fun x -> x.GetSourceFileName) + |> List.insertAt 0 scriptingShim + |> List.map (sprintf " @\"%s\"") + |> String.Concat + + script.Eval("#load " + fileNames ) |> (processScriptResults fs) let eval (cUnit: CompilationUnit) : CompilationResult = match cUnit with @@ -833,13 +868,18 @@ module rec Compiler = evalFSharp fs script | _ -> failwith "Script evaluation is only supported for F#." - let getSessionForEval () = new FSharpScript() + let getSessionForEval args version = new FSharpScript(additionalArgs=args,quiet=false,langVersion=version) let evalInSharedSession (script:FSharpScript) (cUnit: CompilationUnit) : CompilationResult = match cUnit with | FS fs -> evalFSharp fs script | _ -> failwith "Script evaluation is only supported for F#." + let evalScriptFromDiskInSharedSession (script:FSharpScript) (cUnit: CompilationUnit) : CompilationResult = + match cUnit with + | FS fs -> evalScriptFromDisk fs script + | _ -> failwith "Script evaluation is only supported for F#." + let runFsi (cUnit: CompilationUnit) : CompilationResult = match cUnit with | FS fs -> @@ -878,6 +918,7 @@ module rec Compiler = Dependencies = [] Adjust = 0 Diagnostics = [] + PerFileErrors= [] Output = None Compilation = cUnit } @@ -1114,7 +1155,7 @@ module rec Compiler = failwith $"PDB file does not exists: {pdbPath}" | _ -> failwith "Output path is not set, please make sure compilation was successfull." match result with - | CompilationResult.Success r -> verifyPdbExists r + | CompilationResult.Success r -> verifyPdbExists r | _ -> failwith "Result should be \"Success\" in order to verify PDB." let verifyNoPdb (result: CompilationResult): unit = @@ -1126,7 +1167,7 @@ module rec Compiler = failwith $"PDB file exists: {pdbPath}" | _ -> failwith "Output path is not set, please make sure compilation was successfull." match result with - | CompilationResult.Success r -> verifyPdbNotExists r + | CompilationResult.Success r -> verifyPdbNotExists r | _ -> failwith "Result should be \"Success\" in order to verify PDB." [] @@ -1204,7 +1245,7 @@ module rec Compiler = | Some (EvalOutput (Result.Error exn) ) -> sprintf "----script error-----\n%s\n----------" (exn.ToString()) | Some (EvalOutput (Result.Ok fsiVal) ) -> - sprintf "----script output-----\n%A\n----------" (fsiVal) + sprintf "----script output-----\n%A\n----------" (fsiVal) | _ -> () ] |> String.concat "\n" failwith message @@ -1221,11 +1262,11 @@ module rec Compiler = assertErrors what r.Adjust (selector r) expected result - let withResults (expectedResults: ErrorInfo list) result : CompilationResult = + let private withResultsIgnoreNativeRange (expectedResults: ErrorInfo list) result : CompilationResult = assertResultsCategory "Results" (fun r -> r.Diagnostics) expectedResults result - let withResult (expectedResult: ErrorInfo ) (result: CompilationResult) : CompilationResult = - withResults [expectedResult] result + let private withResultIgnoreNativeRange (expectedResult: ErrorInfo ) (result: CompilationResult) : CompilationResult = + withResultsIgnoreNativeRange [expectedResult] result let withDiagnostics (expected: (ErrorType * Line * Col * Line * Col * string) list) (result: CompilationResult) : CompilationResult = let expectedResults: ErrorInfo list = @@ -1237,8 +1278,10 @@ module rec Compiler = StartColumn = startCol EndLine = endLine EndColumn = endCol } + NativeRange = Unchecked.defaultof<_> + SubCategory = "" Message = message } ] - withResults expectedResults result + withResultsIgnoreNativeRange expectedResults result let withSingleDiagnostic (expected: (ErrorType * Line * Col * Line * Col * string)) (result: CompilationResult) : CompilationResult = withDiagnostics [expected] result @@ -1249,6 +1292,64 @@ module rec Compiler = let withError (expectedError: ErrorInfo) (result: CompilationResult) : CompilationResult = withErrors [expectedError] result + module StructuredResultsAsserts = + type SimpleErrorInfo = + { Error: ErrorType + Range: Range + Message: string } + + let withResults (expectedResults: SimpleErrorInfo list) result : CompilationResult = + let mappedResults = expectedResults |> List.map (fun s -> { Error = s.Error;Range = s.Range; Message = s.Message; NativeRange = Unchecked.defaultof<_>; SubCategory = ""}) + Compiler.Assertions.withResultsIgnoreNativeRange mappedResults result + + let withResult (expectedResult: SimpleErrorInfo ) (result: CompilationResult) : CompilationResult = + withResults [expectedResult] result + + + + module TextBasedDiagnosticAsserts = + open FSharp.Compiler.Text.Range + + let private messageAndNumber errorType= + match errorType with + | ErrorType.Error n -> "error",n + | ErrorType.Warning n-> "warning",n + | ErrorType.Hidden n + | ErrorType.Information n-> "info",n + + let normalizeNewLines (s:string) = s.Replace("\r\n","\n").Replace("\n",Environment.NewLine) + + let private renderToString (cr:CompilationResult) = + [ for (file,err) in cr.Output.PerFileErrors do + let m = err.NativeRange + let file = file.Replace("/", "\\") + let severity,no = messageAndNumber err.Error + let adjustedMessage = err.Message |> normalizeNewLines + let location = + if (equals m range0) || (equals m rangeStartup) || (equals m rangeCmdArgs) then + "" + else + // The baseline .bsl files use 1-based notation for columns, hence the +1's + sprintf "%s(%d,%d,%d,%d):" file m.StartLine (m.StartColumn+1) m.EndLine (m.EndColumn+1) + Environment.NewLine + $"{location} {err.SubCategory} {severity} FS%04d{no}: {adjustedMessage}" + Environment.NewLine + ] + |> String.Concat + + let withResultsMatchingFile (path:string) (result:CompilationResult) = + let expectedContent = File.ReadAllText(path) |> normalizeNewLines + let actualErrors = renderToString result + + match Environment.GetEnvironmentVariable("TEST_UPDATE_BSL") with + | null -> () + | _ when expectedContent = actualErrors -> () + | _ -> File.WriteAllText(path, actualErrors) + + match Assert.shouldBeSameMultilineStringSets expectedContent actualErrors with + | None -> () + | Some diff -> Assert.That(diff, Is.Empty, path) + + result + let checkCodes (expected: int list) (selector: CompilationOutput -> ErrorInfo list) (result: CompilationResult) : CompilationResult = match result with | CompilationResult.Success r @@ -1399,6 +1500,6 @@ module rec Compiler = s.Replace("\r", "").Split('\n') |> Array.map (fun line -> line.TrimEnd()) |> String.concat "\n" - + let printSignatures cUnit = printSignaturesImpl None cUnit let printSignaturesWith pageWidth cUnit = printSignaturesImpl (Some pageWidth) cUnit diff --git a/tests/FSharp.Test.Utilities/CompilerAssert.fs b/tests/FSharp.Test.Utilities/CompilerAssert.fs index 0824a065aa0..e0fcacb5af1 100644 --- a/tests/FSharp.Test.Utilities/CompilerAssert.fs +++ b/tests/FSharp.Test.Utilities/CompilerAssert.fs @@ -764,7 +764,12 @@ Updated automatically, please check diffs in your pull request, changes must be |> Async.RunImmediate if parseResults.Diagnostics.Length > 0 then - parseResults.Diagnostics + if options |> Array.contains "--test:ContinueAfterParseFailure" then + [| yield! parseResults.Diagnostics + match fileAnswer with + | FSharpCheckFileAnswer.Succeeded(tcResults) -> yield! tcResults.Diagnostics + | _ -> () |] + else parseResults.Diagnostics else match fileAnswer with diff --git a/tests/FSharp.Test.Utilities/FSharp.Test.Utilities.fsproj b/tests/FSharp.Test.Utilities/FSharp.Test.Utilities.fsproj index 89ab2119ad7..2174c708f42 100644 --- a/tests/FSharp.Test.Utilities/FSharp.Test.Utilities.fsproj +++ b/tests/FSharp.Test.Utilities/FSharp.Test.Utilities.fsproj @@ -17,6 +17,7 @@ scriptlib.fsx + @@ -93,4 +94,6 @@ + + diff --git a/tests/FSharp.Test.Utilities/ScriptHelpers.fs b/tests/FSharp.Test.Utilities/ScriptHelpers.fs index 2a31729dcaa..588dad184c8 100644 --- a/tests/FSharp.Test.Utilities/ScriptHelpers.fs +++ b/tests/FSharp.Test.Utilities/ScriptHelpers.fs @@ -75,7 +75,11 @@ type RedirectConsoleOutput() = type LangVersion = | V47 | V50 + | V60 + | V70 | Preview + | Latest + | SupportsMl type FSharpScript(?additionalArgs: string[], ?quiet: bool, ?langVersion: LangVersion) = @@ -96,8 +100,11 @@ type FSharpScript(?additionalArgs: string[], ?quiet: bool, ?langVersion: LangVer if quiet then "--quiet" match langVersion with | LangVersion.V47 -> "--langversion:4.7" - | LangVersion.V50 -> "--langversion:5.0" + | LangVersion.V50 | LangVersion.SupportsMl -> "--langversion:5.0" | LangVersion.Preview -> "--langversion:preview" + | LangVersion.Latest -> "--langversion:latest" + | LangVersion.V60 -> "--langversion:6.0" + | LangVersion.V70 -> "--langversion:7.0" |] let argv = Array.append baseArgs additionalArgs diff --git a/tests/FSharp.Test.Utilities/ScriptingShims.fsx b/tests/FSharp.Test.Utilities/ScriptingShims.fsx new file mode 100644 index 00000000000..392d2b002b6 --- /dev/null +++ b/tests/FSharp.Test.Utilities/ScriptingShims.fsx @@ -0,0 +1,14 @@ +namespace global + +[] +module GlobalShims = + + let errorStringWriter = new System.IO.StringWriter() + let oldConsoleError = System.Console.Error + do System.Console.SetError(errorStringWriter) + + let exit (code:int) = + System.Console.SetError(oldConsoleError) + if code=0 then + () + else failwith $"Script called function 'exit' with code={code} and collected in stderr: {errorStringWriter.ToString()}" \ No newline at end of file diff --git a/tests/FSharp.Test.Utilities/SurfaceArea.fs b/tests/FSharp.Test.Utilities/SurfaceArea.fs index ca3a3570d16..8dcd2b92970 100644 --- a/tests/FSharp.Test.Utilities/SurfaceArea.fs +++ b/tests/FSharp.Test.Utilities/SurfaceArea.fs @@ -4,49 +4,7 @@ module FSharp.Test.SurfaceArea open System open System.IO open System.Reflection - open System.Text.RegularExpressions - - let private assembleDiffMessage actual expected = - - let getLines text = - use reader = new StringReader(text) - Seq.initInfinite (fun _ -> reader.ReadLine()) - |> Seq.takeWhile (not << isNull) - |> set - let actual = getLines actual - let expected = getLines expected - - /// Surface area types/members which were expected to be found but missing from the actual surface area. - let unexpectedlyMissing = Set.difference expected actual - - /// Surface area types/members present in the actual surface area but weren't expected to be. - let unexpectedlyPresent = Set.difference actual expected - - // If both sets are empty, the surface areas match so allow the test to pass. - if Set.isEmpty unexpectedlyMissing - && Set.isEmpty unexpectedlyPresent then - None - else - // The surface areas don't match; prepare an easily-readable output message. - let msg = - let inline newLine (sb : System.Text.StringBuilder) = sb.AppendLine () |> ignore - let sb = System.Text.StringBuilder () - sb.Append "Unexpectedly missing (expected, not actual):" |> ignore - for s in unexpectedlyMissing do - newLine sb - sb.Append " " |> ignore - sb.Append s |> ignore - newLine sb - newLine sb - sb.Append "Unexpectedly present (actual, not expected):" |> ignore - for s in unexpectedlyPresent do - newLine sb - sb.Append " " |> ignore - sb.Append s |> ignore - newLine sb - sb.ToString () - - Some msg + open System.Text.RegularExpressions // Gets string form of public surface area for the currently-loaded assembly let private getSurfaceAreaForAssembly (assembly: Assembly) = @@ -109,7 +67,7 @@ module FSharp.Test.SurfaceArea File.WriteAllText(logFile, actual) - match assembleDiffMessage expected actual with + match Assert.shouldBeSameMultilineStringSets expected actual with | None -> () | Some diff -> // Update baselines here diff --git a/tests/fsharp/core/auto-widen/5.0/test.bsl b/tests/fsharp/core/auto-widen/5.0/test.bsl index d5b3e596509..f16d2696867 100644 --- a/tests/fsharp/core/auto-widen/5.0/test.bsl +++ b/tests/fsharp/core/auto-widen/5.0/test.bsl @@ -139,16 +139,6 @@ test.fsx(67,20,67,23): typecheck error FS0001: This expression was expected to h but here has type 'int' -test.fsx(67,20,67,23): typecheck error FS0001: This expression was expected to have type - 'obj' -but here has type - 'int' - -test.fsx(68,22,68,25): typecheck error FS0001: This expression was expected to have type - 'int64' -but here has type - 'int' - test.fsx(68,22,68,25): typecheck error FS0001: This expression was expected to have type 'int64' but here has type @@ -159,11 +149,6 @@ test.fsx(69,26,69,29): typecheck error FS0001: This expression was expected to h but here has type 'int' -test.fsx(69,26,69,29): typecheck error FS0001: This expression was expected to have type - 'int64' -but here has type - 'int' - test.fsx(93,13,93,20): typecheck error FS0041: No overloads match for method 'M1'. Known type of argument: int @@ -573,11 +558,6 @@ test.fsx(291,21,291,30): typecheck error FS0001: This expression was expected to but here has type 'string' -test.fsx(291,21,291,30): typecheck error FS0001: This expression was expected to have type - 'obj' -but here has type - 'string' - test.fsx(292,24,292,26): typecheck error FS0001: This expression was expected to have type 'obj' but here has type diff --git a/tests/fsharp/core/auto-widen/minimal/test.fsx b/tests/fsharp/core/auto-widen/minimal/test.fsx new file mode 100644 index 00000000000..92e7cfc56da --- /dev/null +++ b/tests/fsharp/core/auto-widen/minimal/test.fsx @@ -0,0 +1,6 @@ +#r "System.Xml.Linq.dll" +#r "System.Xml.XDocument.dll" + +let ns : System.Xml.Linq.XNamespace = "" +System.IO.File.WriteAllText("test.ok","ok") +exit 0 \ No newline at end of file diff --git a/tests/fsharp/core/auto-widen/preview-default-warns/test.bsl b/tests/fsharp/core/auto-widen/preview-default-warns/test.bsl index fc365207280..0e6a2d51844 100644 --- a/tests/fsharp/core/auto-widen/preview-default-warns/test.bsl +++ b/tests/fsharp/core/auto-widen/preview-default-warns/test.bsl @@ -18,10 +18,6 @@ but here has type test.fsx(471,18,471,19): typecheck error FS0044: This construct is deprecated. nope -test.fsx(482,18,482,21): typecheck error FS3387: This expression has type 'B' and is only made compatible with type 'C' through an ambiguous implicit conversion. Consider using an explicit call to 'op_Implicit'. The applicable implicit conversions are: - static member B.op_Implicit: x: B -> C - static member C.op_Implicit: x: B -> C - test.fsx(482,18,482,21): typecheck error FS3387: This expression has type 'B' and is only made compatible with type 'C' through an ambiguous implicit conversion. Consider using an explicit call to 'op_Implicit'. The applicable implicit conversions are: static member B.op_Implicit: x: B -> C static member C.op_Implicit: x: B -> C diff --git a/tests/fsharp/core/auto-widen/preview/test.bsl b/tests/fsharp/core/auto-widen/preview/test.bsl index f449e09a610..24fa4a641cd 100644 --- a/tests/fsharp/core/auto-widen/preview/test.bsl +++ b/tests/fsharp/core/auto-widen/preview/test.bsl @@ -79,12 +79,6 @@ test.fsx(64,50,64,71): typecheck error FS3388: This expression implicitly conver test.fsx(67,20,67,23): typecheck error FS3388: This expression implicitly converts type 'int' to type 'obj'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(67,20,67,23): typecheck error FS3388: This expression implicitly converts type 'int' to type 'obj'. See https://aka.ms/fsharp-implicit-convs. - -test.fsx(68,22,68,25): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. - -test.fsx(68,22,68,25): typecheck error FS3388: This expression implicitly converts type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. - test.fsx(68,22,68,25): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. test.fsx(68,22,68,25): typecheck error FS3388: This expression implicitly converts type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. @@ -93,26 +87,16 @@ test.fsx(69,26,69,29): typecheck error FS3389: This expression uses a built-in i test.fsx(69,26,69,29): typecheck error FS3388: This expression implicitly converts type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(69,26,69,29): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. - -test.fsx(69,26,69,29): typecheck error FS3388: This expression implicitly converts type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. - -test.fsx(93,18,93,19): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. - test.fsx(93,18,93,19): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. test.fsx(99,20,99,21): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(99,20,99,21): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. - test.fsx(116,20,116,21): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. test.fsx(116,20,116,21): typecheck error FS3388: This expression implicitly converts type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. test.fsx(121,19,121,20): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(121,19,121,20): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. - test.fsx(122,19,122,20): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. test.fsx(122,19,122,20): typecheck error FS3388: This expression implicitly converts type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. @@ -123,8 +107,6 @@ test.fsx(122,22,122,23): typecheck error FS3388: This expression implicitly conv test.fsx(127,19,127,20): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'double'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(127,19,127,20): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'double'. See https://aka.ms/fsharp-implicit-convs. - test.fsx(128,19,128,20): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'double'. See https://aka.ms/fsharp-implicit-convs. test.fsx(128,19,128,20): typecheck error FS3388: This expression implicitly converts type 'int' to type 'double'. See https://aka.ms/fsharp-implicit-convs. @@ -167,8 +149,6 @@ test.fsx(165,18,165,19): typecheck error FS3388: This expression implicitly conv test.fsx(172,18,172,21): typecheck error FS3395: This expression uses the implicit conversion 'static member Y.op_Implicit: y: Y -> X' to convert type 'Y' to type 'X'. -test.fsx(172,18,172,21): typecheck error FS3395: This expression uses the implicit conversion 'static member Y.op_Implicit: y: Y -> X' to convert type 'Y' to type 'X'. - test.fsx(178,20,178,21): typecheck error FS3391: This expression uses the implicit conversion 'static member C.op_Implicit: x: 'T -> C<'T>' to convert type 'int' to type 'C'. See https://aka.ms/fsharp-implicit-convs. This warning may be disabled using '#nowarn "3391". test.fsx(178,20,178,21): typecheck error FS3388: This expression implicitly converts type 'int' to type 'C'. See https://aka.ms/fsharp-implicit-convs. @@ -233,16 +213,12 @@ test.fsx(216,34,216,35): typecheck error FS3388: This expression implicitly conv test.fsx(219,20,219,33): typecheck error FS3388: This expression implicitly converts type 'U' to type 'obj'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(219,20,219,33): typecheck error FS3388: This expression implicitly converts type 'U' to type 'obj'. See https://aka.ms/fsharp-implicit-convs. - test.fsx(222,21,222,31): typecheck error FS3388: This expression implicitly converts type 'U' to type 'obj'. See https://aka.ms/fsharp-implicit-convs. test.fsx(225,21,225,31): typecheck error FS3388: This expression implicitly converts type 'int -> U' to type 'obj'. See https://aka.ms/fsharp-implicit-convs. test.fsx(228,21,228,40): typecheck error FS3388: This expression implicitly converts type 'SU' to type 'obj'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(228,21,228,40): typecheck error FS3388: This expression implicitly converts type 'SU' to type 'obj'. See https://aka.ms/fsharp-implicit-convs. - test.fsx(231,21,231,37): typecheck error FS3388: This expression implicitly converts type 'SU' to type 'obj'. See https://aka.ms/fsharp-implicit-convs. test.fsx(234,21,234,37): typecheck error FS3388: This expression implicitly converts type 'int -> SU' to type 'obj'. See https://aka.ms/fsharp-implicit-convs. @@ -317,8 +293,6 @@ test.fsx(290,21,290,23): typecheck error FS3388: This expression implicitly conv test.fsx(291,21,291,30): typecheck error FS3388: This expression implicitly converts type 'string' to type 'obj'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(291,21,291,30): typecheck error FS3388: This expression implicitly converts type 'string' to type 'obj'. See https://aka.ms/fsharp-implicit-convs. - test.fsx(292,24,292,26): typecheck error FS3388: This expression implicitly converts type 'string' to type 'obj'. See https://aka.ms/fsharp-implicit-convs. test.fsx(295,34,295,35): typecheck error FS3388: This expression implicitly converts type 'int' to type 'obj'. See https://aka.ms/fsharp-implicit-convs. @@ -604,22 +578,10 @@ test.fsx(482,18,482,21): typecheck error FS3387: This expression has type 'B' an test.fsx(482,18,482,21): typecheck error FS3395: This expression uses the implicit conversion 'static member B.op_Implicit: x: B -> C' to convert type 'B' to type 'C'. -test.fsx(482,18,482,21): typecheck error FS3387: This expression has type 'B' and is only made compatible with type 'C' through an ambiguous implicit conversion. Consider using an explicit call to 'op_Implicit'. The applicable implicit conversions are: - static member B.op_Implicit: x: B -> C - static member C.op_Implicit: x: B -> C - -test.fsx(482,18,482,21): typecheck error FS3395: This expression uses the implicit conversion 'static member B.op_Implicit: x: B -> C' to convert type 'B' to type 'C'. - -test.fsx(507,18,507,21): typecheck error FS3395: This expression uses the implicit conversion 'static member C.op_Implicit: x: B -> C' to convert type 'B' to type 'C'. - test.fsx(507,18,507,21): typecheck error FS3395: This expression uses the implicit conversion 'static member C.op_Implicit: x: B -> C' to convert type 'B' to type 'C'. test.fsx(519,18,519,21): typecheck error FS3395: This expression uses the implicit conversion 'static member B.op_Implicit: x: B -> C' to convert type 'B' to type 'C'. -test.fsx(519,18,519,21): typecheck error FS3395: This expression uses the implicit conversion 'static member B.op_Implicit: x: B -> C' to convert type 'B' to type 'C'. - -test.fsx(538,18,538,21): typecheck error FS3395: This expression uses the implicit conversion 'static member C.op_Implicit: x: B -> C' to convert type 'B' to type 'C'. - test.fsx(538,18,538,21): typecheck error FS3395: This expression uses the implicit conversion 'static member C.op_Implicit: x: B -> C' to convert type 'B' to type 'C'. test.fsx(543,30,543,31): typecheck error FS0001: This expression was expected to have type diff --git a/tests/fsharp/core/members/ops/test.fsx b/tests/fsharp/core/members/ops/test.fsx index 4c0581d42ca..1f76c94ef46 100644 --- a/tests/fsharp/core/members/ops/test.fsx +++ b/tests/fsharp/core/members/ops/test.fsx @@ -415,7 +415,7 @@ let RUN() = !failures let aa = match !failures with | [] -> - stdout.WriteLine "Test Passed" + stdout.WriteLine "Test Passed" System.IO.File.WriteAllText("test.ok","ok") exit 0 | _ -> diff --git a/tests/fsharp/core/namespaces/test2.fs b/tests/fsharp/core/namespaces/test2.fs index 19d215d4a00..230ffcca48b 100644 --- a/tests/fsharp/core/namespaces/test2.fs +++ b/tests/fsharp/core/namespaces/test2.fs @@ -13,7 +13,7 @@ module M = #if TESTS_AS_APP - let RUN() = !failures + let RUN() = !Hello.Goodbye.Utils.failures #else let aa = if not (!Hello.Goodbye.Utils.failures).IsEmpty then diff --git a/tests/fsharp/core/printf/test.fsx b/tests/fsharp/core/printf/test.fsx index 8ea722c9ee4..cf78d1a8cbd 100644 --- a/tests/fsharp/core/printf/test.fsx +++ b/tests/fsharp/core/printf/test.fsx @@ -447,8 +447,9 @@ module CheckDisplayAttributes12 = member internal x.Hello = "Hello" override x.ToString() = "x" + let tName = typeof.FullName // this should produce an error - test "cenwoiwe12" (lazy(sprintf "%A" (Foo()))) "" + test "cenwoiwe12" (lazy(sprintf "%A" (Foo()))) ("") // Check one with an unmatched closing bracket module CheckDisplayAttributes13 = diff --git a/tests/fsharp/core/subtype/test.fsx b/tests/fsharp/core/subtype/test.fsx index 76de2b2d520..c9aa30a006b 100644 --- a/tests/fsharp/core/subtype/test.fsx +++ b/tests/fsharp/core/subtype/test.fsx @@ -1088,7 +1088,7 @@ module InnerConstrainedClosureTests = printfn "hello, %A" z /// This uses the local type function in another closure that also captures one of the outer arguments let h() = g(3,y) - /// This just returnes the closure to make sure we don't optimize it all away + // This just returnes the closure to make sure we don't optimize it all away h @@ -1099,7 +1099,7 @@ module InnerConstrainedClosureTests = printfn "hello, %A" z /// This uses the local type function in another closure that also captures one of the outer arguments let h() = g(3) - /// This just returnes the closure to make sure we don't optimize it all away + // This just returnes the closure to make sure we don't optimize it all away h let Example3 (y:'b,z:'a) = @@ -1108,7 +1108,7 @@ module InnerConstrainedClosureTests = printfn "hello, %A" z /// This uses the local type function in another closure that also captures one of the outer arguments let h() = g(3,y) - /// This just returnes the closure to make sure we don't optimize it all away + // This just returnes the closure to make sure we don't optimize it all away h let Example4 (y:'b,z:'a) = @@ -1119,7 +1119,7 @@ module InnerConstrainedClosureTests = let h1() = g(3,4,y) /// This uses the local type function in another closure that also captures one of the outer arguments let h2() = g("3","4",y) - /// This just returnes the closure to make sure we don't optimize it all away + // This just returnes the closure to make sure we don't optimize it all away h1,h2 @@ -1132,7 +1132,7 @@ module InnerConstrainedClosureTests = let h1() = g(3,4,y) /// This uses the local type function in another closure that also captures one of the outer arguments let h2() = g("3","4",y) - /// This just returnes the closure to make sure we don't optimize it all away + // This just returnes the closure to make sure we don't optimize it all away h1,h2 let Example6 (y:'b,z:'a) = diff --git a/tests/fsharp/core/unicode/test.fsx b/tests/fsharp/core/unicode/test.fsx index 9b7303c0d32..10089e9dd0b 100644 --- a/tests/fsharp/core/unicode/test.fsx +++ b/tests/fsharp/core/unicode/test.fsx @@ -24,6 +24,8 @@ let input_byte (x : System.IO.FileStream) = let b = x.ReadByte() if b = -1 then raise (System.IO.EndOfStreamException()) else b +let bslFilePath = Path.Combine(__SOURCE_DIRECTORY__,"out.bsl") + let test2925 () = printfn "test2925..."; (* This writes a file in the standard utf8 encoding. Probably needs to be adjusted if default encodings differ *) @@ -32,7 +34,7 @@ let test2925 () = os.Write "\u2260"; (* not equals *) os.Dispose(); use is1 = System.IO.File.OpenRead "out1.txt" in - use is2 = System.IO.File.OpenRead "out.bsl" in + use is2 = System.IO.File.OpenRead bslFilePath in try while true do let c2 = input_byte is2 in @@ -54,7 +56,7 @@ let test2925b () = os.Write "\U00002260"; (* not equals *) os.Dispose(); let is1 = System.IO.File.OpenRead "out1.txt" in - let is2 = System.IO.File.OpenRead "out.bsl" in + let is2 = System.IO.File.OpenRead bslFilePath in try while true do let c2 = input_byte is2 in @@ -77,7 +79,7 @@ let test2926 () = Printf.printf "length s = %d\n" (String.length s); os.Dispose(); let is1 = System.IO.File.OpenRead "out2.txt" in - let is2 = System.IO.File.OpenRead "out.bsl" in + let is2 = System.IO.File.OpenRead bslFilePath in try while true do let c2 = input_byte is2 in diff --git a/tests/fsharp/tests.fs b/tests/fsharp/tests.fs index 960f97cf19d..35700a83aea 100644 --- a/tests/fsharp/tests.fs +++ b/tests/fsharp/tests.fs @@ -35,352 +35,9 @@ let testConfig = getTestsDirectory >> testConfig [] module CoreTests = - // These tests are enabled for .NET Framework and .NET Core - [] - let ``access-FSC_DEBUG``() = singleTestBuildAndRun "core/access" FSC_DEBUG - - [] - let ``access-FSC_OPTIMIZED``() = singleTestBuildAndRun "core/access" FSC_OPTIMIZED - - [] - let ``access-FSI``() = singleTestBuildAndRun "core/access" FSI - - [] - let ``apporder-FSC_DEBUG`` () = singleTestBuildAndRun "core/apporder" FSC_DEBUG - - [] - let ``apporder-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/apporder" FSC_OPTIMIZED - - [] - let ``apporder-FSI`` () = singleTestBuildAndRun "core/apporder" FSI - - [] - let ``array-FSC_DEBUG-5.0`` () = singleTestBuildAndRunVersion "core/array" FSC_DEBUG "5.0" - - [] - let ``array-FSC_OPTIMIZED-5.0`` () = singleTestBuildAndRunVersion "core/array" FSC_OPTIMIZED "5.0" - - [] - let ``array-FSI-5.0`` () = singleTestBuildAndRunVersion "core/array" FSI "5.0" - - [] - let ``array-FSC_OPTIMIZED-preview`` () = singleTestBuildAndRunVersion "core/array" FSC_OPTIMIZED "preview" - - [] - let ``array-no-dot-FSC_DEBUG`` () = singleTestBuildAndRunVersion "core/array-no-dot" FSC_DEBUG "preview" - - [] - let ``array-no-dot-FSC_OPTIMIZED`` () = singleTestBuildAndRunVersion "core/array-no-dot" FSC_OPTIMIZED "preview" - - [] - let ``array-no-dot-FSI`` () = singleTestBuildAndRunVersion "core/array-no-dot" FSI "preview" - - [] - let ``array-no-dot-warnings-langversion-default`` () = - let cfg = testConfig "core/array-no-dot-warnings" - singleVersionedNegTest cfg "default" "test-langversion-default" - - [] - let ``array-no-dot-warnings-langversion-5_0`` () = - let cfg = testConfig "core/array-no-dot-warnings" - singleVersionedNegTest cfg "5.0" "test-langversion-5.0" - - [] - let ``ref-ops-deprecation-langversion-preview`` () = - let cfg = testConfig "core/ref-ops-deprecation" - singleVersionedNegTest cfg "preview" "test-langversion-preview" - - [] - [] - let ``auto-widen-version-5_0``() = - let cfg = testConfig "core/auto-widen/5.0" - singleVersionedNegTest cfg "5.0" "test" - - [] - [] - let ``auto-widen-version-FSC_DEBUG-preview``() = - singleTestBuildAndRunVersion "core/auto-widen/preview" FSC_DEBUG "preview" - - [] - [] - let ``auto-widen-version-FSC_OPTIMIZED-preview``() = - singleTestBuildAndRunVersion "core/auto-widen/preview" FSC_OPTIMIZED "preview" - - [] - [] - let ``auto-widen-version-preview-warns-on``() = - let cfg = testConfig "core/auto-widen/preview" - let cfg = { cfg with fsc_flags = cfg.fsc_flags + " --warnon:3388 --warnon:3389 --warnon:3395 --warnaserror+ --define:NEGATIVE" } - singleVersionedNegTest cfg "preview" "test" - - [] - [] - let ``auto-widen-version-preview-default-warns``() = - let cfg = testConfig "core/auto-widen/preview-default-warns" - let cfg = { cfg with fsc_flags = cfg.fsc_flags + " --warnaserror+ --define:NEGATIVE" } - singleVersionedNegTest cfg "preview" "test" - - [] - let ``comprehensions-FSC_DEBUG`` () = singleTestBuildAndRun "core/comprehensions" FSC_DEBUG - - [] - let ``comprehensions-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/comprehensions" FSC_OPTIMIZED - - [] - let ``comprehensions-FSI`` () = singleTestBuildAndRun "core/comprehensions" FSI - - [] - let ``comprehensionshw-FSC_DEBUG`` () = singleTestBuildAndRun "core/comprehensions-hw" FSC_DEBUG - - [] - let ``comprehensionshw-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/comprehensions-hw" FSC_OPTIMIZED - - [] - let ``comprehensionshw-FSI`` () = singleTestBuildAndRun "core/comprehensions-hw" FSI - - [] - let ``genericmeasures-FSC_DEBUG`` () = singleTestBuildAndRun "core/genericmeasures" FSC_DEBUG - - [] - let ``genericmeasures-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/genericmeasures" FSC_OPTIMIZED - - [] - let ``genericmeasures-FSI`` () = singleTestBuildAndRun "core/genericmeasures" FSI - - [] - let ``innerpoly-FSC_DEBUG`` () = singleTestBuildAndRun "core/innerpoly" FSC_DEBUG - - [] - let ``innerpoly-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/innerpoly" FSC_OPTIMIZED - - [] - let ``innerpoly-FSI`` () = singleTestBuildAndRun "core/innerpoly" FSI - - [] - let ``namespaceAttributes-FSC_DEBUG`` () = singleTestBuildAndRun "core/namespaces" FSC_DEBUG - - [] - let ``namespaceAttributes-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/namespaces" FSC_OPTIMIZED - - [] - let ``unicode2-FSC_DEBUG`` () = singleTestBuildAndRun "core/unicode" FSC_DEBUG // TODO: fails on coreclr - - [] - let ``unicode2-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/unicode" FSC_OPTIMIZED // TODO: fails on coreclr - - [] - let ``unicode2-FSI`` () = singleTestBuildAndRun "core/unicode" FSI - - [] - let ``lazy test-FSC_DEBUG`` () = singleTestBuildAndRun "core/lazy" FSC_DEBUG - - [] - let ``lazy test-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/lazy" FSC_OPTIMIZED - - [] - let ``lazy test-FSI`` () = singleTestBuildAndRun "core/lazy" FSI - - [] - let ``letrec-FSC_DEBUG`` () = singleTestBuildAndRun "core/letrec" FSC_DEBUG - - [] - let ``letrec-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/letrec" FSC_OPTIMIZED - - [] - let ``letrec-FSI`` () = singleTestBuildAndRun "core/letrec" FSI - - [] - let ``letrec (mutrec variations part one) FSC_DEBUG`` () = singleTestBuildAndRun "core/letrec-mutrec" FSC_DEBUG - - [] - let ``letrec (mutrec variations part one) FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/letrec-mutrec" FSC_OPTIMIZED - - [] - let ``letrec (mutrec variations part one) FSI`` () = singleTestBuildAndRun "core/letrec-mutrec" FSI - - [] - let ``libtest-FSC_DEBUG`` () = singleTestBuildAndRun "core/libtest" FSC_DEBUG - - [] - let ``libtest-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/libtest" FSC_OPTIMIZED - - [] - let ``libtest-FSI`` () = singleTestBuildAndRun "core/libtest" FSI - - [] - let ``lift-FSC_DEBUG`` () = singleTestBuildAndRun "core/lift" FSC_DEBUG - - [] - let ``lift-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/lift" FSC_OPTIMIZED - - [] - let ``lift-FSI`` () = singleTestBuildAndRun "core/lift" FSI - - [] - let ``map-FSC_DEBUG`` () = singleTestBuildAndRun "core/map" FSC_DEBUG - - [] - let ``map-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/map" FSC_OPTIMIZED - - [] - let ``map-FSI`` () = singleTestBuildAndRun "core/map" FSI - - [] - let ``measures-FSC_DEBUG`` () = singleTestBuildAndRun "core/measures" FSC_DEBUG - - [] - let ``measures-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/measures" FSC_OPTIMIZED - - [] - let ``measures-FSI`` () = singleTestBuildAndRun "core/measures" FSI - - [] - let ``nested-FSC_DEBUG`` () = singleTestBuildAndRun "core/nested" FSC_DEBUG - - [] - let ``nested-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/nested" FSC_OPTIMIZED - - [] - let ``nested-FSI`` () = singleTestBuildAndRun "core/nested" FSI - - [] - let ``members-ops-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/members/ops" FSC_OPTIMIZED - - [] - let ``members-ops-FSC_DEBUG`` () = singleTestBuildAndRun "core/members/ops" FSC_DEBUG - - [] - let ``members-ops-FSI`` () = singleTestBuildAndRun "core/members/ops" FSI - - [] - let ``members-ops-mutrec-FSC_DEBUG`` () = singleTestBuildAndRun "core/members/ops-mutrec" FSC_DEBUG - - [] - let ``members-ops-mutrec-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/members/ops-mutrec" FSC_OPTIMIZED - - [] - let ``members-ops-mutrec-FSI`` () = singleTestBuildAndRun "core/members/ops-mutrec" FSI - - [] - let ``seq-FSC_DEBUG`` () = singleTestBuildAndRun "core/seq" FSC_DEBUG - - [] - let ``seq-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/seq" FSC_OPTIMIZED - - [] - let ``seq-FSI`` () = singleTestBuildAndRun "core/seq" FSI - - [] - let ``math-numbers-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/math/numbers" FSC_OPTIMIZED - - [] - let ``math-numbers-FSI`` () = singleTestBuildAndRun "core/math/numbers" FSI - - [] - let ``members-ctree-FSC_DEBUG`` () = singleTestBuildAndRun "core/members/ctree" FSC_DEBUG - - [] - let ``members-ctree-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/members/ctree" FSC_OPTIMIZED - - [] - let ``members-ctree-FSI`` () = singleTestBuildAndRun "core/members/ctree" FSI - - [] - let ``members-factors-FSC_DEBUG`` () = singleTestBuildAndRun "core/members/factors" FSC_DEBUG - - [] - let ``members-factors-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/members/factors" FSC_OPTIMIZED - - [] - let ``members-factors-FSI`` () = singleTestBuildAndRun "core/members/factors" FSI - - [] - let ``members-factors-mutrec-FSC_DEBUG`` () = singleTestBuildAndRun "core/members/factors-mutrec" FSC_DEBUG - - [] - let ``members-factors-mutrec-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/members/factors-mutrec" FSC_OPTIMIZED - - [] - let ``members-factors-mutrec-FSI`` () = singleTestBuildAndRun "core/members/factors-mutrec" FSI - - [] - let ``graph-FSC_DEBUG`` () = singleTestBuildAndRunVersion "perf/graph" FSC_DEBUG "supports-ml" - - [] - let ``graph-FSC_OPTIMIZED`` () = singleTestBuildAndRunVersion "perf/graph" FSC_OPTIMIZED "supports-ml" - - [] - let ``graph-FSI`` () = singleTestBuildAndRunVersion "perf/graph" FSI "supports-ml" - - [] - let ``nbody-FSC_DEBUG`` () = singleTestBuildAndRunVersion "perf/nbody" FSC_DEBUG "supports-ml" - - [] - let ``nbody-FSC_OPTIMIZED`` () = singleTestBuildAndRunVersion "perf/nbody" FSC_OPTIMIZED "supports-ml" - - [] - let ``nbody-FSI`` () = singleTestBuildAndRunVersion "perf/nbody" FSI "supports-ml" - - [] - let ``forexpression-FSC_DEBUG`` () = singleTestBuildAndRun "core/forexpression" FSC_DEBUG - - [] - let ``forexpression-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/forexpression" FSC_OPTIMIZED - - [] - let ``forexpression-FSI`` () = singleTestBuildAndRun "core/forexpression" FSI - - [] - let ``letrec (mutrec variations part two) FSC_DEBUG`` () = singleTestBuildAndRun "core/letrec-mutrec2" FSC_DEBUG - - [] - let ``letrec (mutrec variations part two) FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/letrec-mutrec2" FSC_OPTIMIZED - - [] - let ``letrec (mutrec variations part two) FSI`` () = singleTestBuildAndRun "core/letrec-mutrec2" FSI - - [] - let ``printf`` () = singleTestBuildAndRunVersion "core/printf" FSC_OPTIMIZED "preview" - - [] - let ``printf-interpolated`` () = singleTestBuildAndRunVersion "core/printf-interpolated" FSC_OPTIMIZED "preview" - - [] - let ``tlr-FSC_DEBUG`` () = singleTestBuildAndRun "core/tlr" FSC_DEBUG - - [] - let ``tlr-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/tlr" FSC_OPTIMIZED - - [] - let ``tlr-FSI`` () = singleTestBuildAndRun "core/tlr" FSI - - [] - let ``subtype-FSC_DEBUG`` () = singleTestBuildAndRun "core/subtype" FSC_DEBUG - - [] - let ``subtype-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/subtype" FSC_OPTIMIZED - - [] - let ``subtype-FSI`` () = singleTestBuildAndRun "core/subtype" FSI - - [] - let ``syntax-FSC_DEBUG`` () = singleTestBuildAndRun "core/syntax" FSC_DEBUG - - [] - let ``syntax-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/syntax" FSC_OPTIMIZED - - [] - let ``syntax-FSI`` () = singleTestBuildAndRun "core/syntax" FSI - - [] - let ``test int32-FSC_DEBUG`` () = singleTestBuildAndRun "core/int32" FSC_DEBUG - - [] - let ``test int32-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/int32" FSC_OPTIMIZED - - [] - let ``test int32-FSI`` () = singleTestBuildAndRun "core/int32" FSI +#if !NETCOREAPP +// This test stays in FsharpSuite for a later migration phases, it uses hardcoded #r to a C# compiled cslib.dll inside [] let ``quotes-FSC-FSC_DEBUG`` () = singleTestBuildAndRun "core/quotes" FSC_DEBUG @@ -389,15 +46,23 @@ module CoreTests = [] let ``quotes-FSI-BASIC`` () = singleTestBuildAndRun "core/quotes" FSI +#endif + +#if !NETCOREAPP +// This test has hardcoded expectations about current synchronization context +// Will be moved out of FsharpSuite.Tests in a later phase for desktop framework [] - let ``recordResolution-FSC_DEBUG`` () = singleTestBuildAndRun "core/recordResolution" FSC_DEBUG + let ``control-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/control" FSC_OPTIMIZED [] - let ``recordResolution-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/recordResolution" FSC_OPTIMIZED + let ``control-FSI`` () = singleTestBuildAndRun "core/control" FSI [] - let ``recordResolution-FSI`` () = singleTestBuildAndRun "core/recordResolution" FSI + let ``control --tailcalls`` () = + let cfg = testConfig "core/control" + singleTestBuildAndRunAux {cfg with fsi_flags = " --tailcalls" } FSC_OPTIMIZED +#endif [] let ``SDKTests`` () = @@ -652,49 +317,7 @@ module CoreTests = #endif - [] - let ``control-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/control" FSC_OPTIMIZED - - [] - let ``control-FSI`` () = singleTestBuildAndRun "core/control" FSI - - [] - let ``control --tailcalls`` () = - let cfg = testConfig "core/control" - singleTestBuildAndRunAux {cfg with fsi_flags = " --tailcalls" } FSC_OPTIMIZED - - [] - let ``controlChamenos-FSC_OPTIMIZED`` () = - let cfg = testConfig "core/controlChamenos" - singleTestBuildAndRunAux {cfg with fsi_flags = " --tailcalls" } FSC_OPTIMIZED - - [] - let ``controlChamenos-FSI`` () = - let cfg = testConfig "core/controlChamenos" - singleTestBuildAndRunAux {cfg with fsi_flags = " --tailcalls" } FSI - - [] - let ``controlMailbox-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/controlMailbox" FSC_OPTIMIZED - - [] - let ``controlMailbox-FSI`` () = singleTestBuildAndRun "core/controlMailbox" FSI - - [] - let ``controlMailbox --tailcalls`` () = - let cfg = testConfig "core/controlMailbox" - singleTestBuildAndRunAux {cfg with fsi_flags = " --tailcalls" } FSC_OPTIMIZED - - [] - let ``csext-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/csext" FSC_OPTIMIZED - [] - let ``csext-FSI`` () = singleTestBuildAndRun "core/csext" FSI - - [] - let ``enum-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/enum" FSC_OPTIMIZED - - [] - let ``enum-FSI`` () = singleTestBuildAndRun "core/enum" FSI #if !NETCOREAPP @@ -1581,68 +1204,15 @@ module CoreTests = | _ -> Assert.Fail (sprintf "'%s' and '%s' differ; %A" stderrPath stderrBaseline diffs2) #endif - [] - let ``longnames-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/longnames" FSC_OPTIMIZED - [] - let ``longnames-FSI`` () = singleTestBuildAndRun "core/longnames" FSI - [] - let ``math-numbersVS2008-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/math/numbersVS2008" FSC_OPTIMIZED - - [] - let ``math-numbersVS2008-FSI`` () = singleTestBuildAndRun "core/math/numbersVS2008" FSI - - [] - let ``patterns-FSC_OPTIMIZED`` () = singleTestBuildAndRunVersion "core/patterns" FSC_OPTIMIZED "preview" - -// This requires --multiemit on by default, which is not the case for .NET Framework -#if NETCOREAPP - [] - let ``patterns-FSI`` () = singleTestBuildAndRun "core/patterns" FSI -#endif - - [] - let ``pinvoke-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/pinvoke" FSC_OPTIMIZED - - [] - let ``pinvoke-FSI`` () = - singleTestBuildAndRun "core/pinvoke" FSI - - [] - let ``fsi_load-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/fsi-load" FSC_OPTIMIZED - - [] - let ``fsi_load-FSI`` () = singleTestBuildAndRun "core/fsi-load" FSI - -#if !NETCOREAPP +#if !NETCOREAPP [] let ``measures-FSC_NETFX_TEST_ROUNDTRIP_AS_DLL`` () = singleTestBuildAndRun "core/measures" FSC_NETFX_TEST_ROUNDTRIP_AS_DLL [] let ``members-basics-FSC_NETFX_TEST_ROUNDTRIP_AS_DLL`` () = singleTestBuildAndRun "core/members/basics" FSC_NETFX_TEST_ROUNDTRIP_AS_DLL - [] - let ``members-basics-hw`` () = singleTestBuildAndRun "core/members/basics-hw" FSC_OPTIMIZED - - [] - let ``members-basics-hw-mutrec`` () = singleTestBuildAndRun "core/members/basics-hw-mutrec" FSC_OPTIMIZED - - [] - let ``members-incremental-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/members/incremental" FSC_OPTIMIZED - - [] - let ``members-incremental-FSI`` () = singleTestBuildAndRun "core/members/incremental" FSI - - [] - let ``members-incremental-hw-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/members/incremental-hw" FSC_OPTIMIZED - - [] - let ``members-incremental-hw-FSI`` () = singleTestBuildAndRun "core/members/incremental-hw" FSI - - [] - let ``members-incremental-hw-mutrec-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/members/incremental-hw-mutrec" FSC_OPTIMIZED - [] let queriesLeafExpressionConvert () = let cfg = testConfig "core/queriesLeafExpressionConvert" @@ -1840,11 +1410,7 @@ module CoreTests = testOkFile.CheckExists() #endif - [] - let ``reflect-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/reflect" FSC_OPTIMIZED - [] - let ``reflect-FSI`` () = singleTestBuildAndRun "core/reflect" FSI #if !NETCOREAPP [] @@ -2482,9 +2048,6 @@ module TypecheckTests = let cfg = testConfig "typecheck/full-rank-arrays" SingleTest.singleTestBuildAndRunWithCopyDlls cfg "full-rank-arrays.dll" FSC_OPTIMIZED - [] - let misc () = singleTestBuildAndRunVersion "typecheck/misc" FSC_OPTIMIZED "supports-ml" - #if !NETCOREAPP [] @@ -2738,31 +2301,10 @@ module TypecheckTests = fsc cfg "%s -a -o:pos05.dll" cfg.fsc_flags ["pos05.fs"] [] - let ``type check neg01`` () = singleNegTest (testConfig "typecheck/sigs") "neg01" - - [] - let ``type check neg02`` () = singleVersionedNegTest (testConfig "typecheck/sigs") "6.0" "neg02" - - [] - let ``type check neg03`` () = singleVersionedNegTest (testConfig "typecheck/sigs") "supports-ml*" "neg03" + let ``type check neg01`` () = singleNegTest (testConfig "typecheck/sigs") "neg01" [] - let ``type check neg04`` () = singleNegTest (testConfig "typecheck/sigs") "neg04" - - [] - let ``type check neg05`` () = singleNegTest (testConfig "typecheck/sigs") "neg05" - - [] - let ``type check neg06`` () = singleNegTest (testConfig "typecheck/sigs") "neg06" - - [] - let ``type check neg06_a`` () = singleNegTest (testConfig "typecheck/sigs") "neg06_a" - - [] - let ``type check neg06_b`` () = singleNegTest (testConfig "typecheck/sigs") "neg06_b" - - [] - let ``type check neg07`` () = singleNegTest (testConfig "typecheck/sigs") "neg07" + let ``type check neg03`` () = singleVersionedNegTest (testConfig "typecheck/sigs") "supports-ml*" "neg03" [] let ``type check neg08`` () = singleNegTest (testConfig "typecheck/sigs") "neg08" @@ -2771,53 +2313,14 @@ module TypecheckTests = let ``type check neg09`` () = singleNegTest (testConfig "typecheck/sigs") "neg09" [] - let ``type check neg10`` () = singleNegTest (testConfig "typecheck/sigs") "neg10" - - [] - let ``type check neg10_a`` () = singleNegTest (testConfig "typecheck/sigs") "neg10_a" - - [] - let ``type check neg11`` () = singleNegTest (testConfig "typecheck/sigs") "neg11" - - [] - let ``type check neg12`` () = singleNegTest (testConfig "typecheck/sigs") "neg12" - - [] - let ``type check neg13`` () = singleNegTest (testConfig "typecheck/sigs") "neg13" - - [] - let ``type check neg14`` () = singleNegTest (testConfig "typecheck/sigs") "neg14" - + let ``type check neg10`` () = singleNegTest (testConfig "typecheck/sigs") "neg10" + [] - let ``type check neg15`` () = singleNegTest (testConfig "typecheck/sigs") "neg15" - - [] - let ``type check neg16`` () = singleNegTest (testConfig "typecheck/sigs") "neg16" + let ``type check neg14`` () = singleNegTest (testConfig "typecheck/sigs") "neg14" [] let ``type check neg17`` () = singleNegTest (testConfig "typecheck/sigs") "neg17" - [] - let ``type check neg18`` () = singleNegTest (testConfig "typecheck/sigs") "neg18" - - [] - let ``type check neg19`` () = singleNegTest (testConfig "typecheck/sigs") "neg19" - - [] - let ``type check neg20`` () = singleNegTest (testConfig "typecheck/sigs") "neg20" - - [] - [] - let ``type check neg20 version 5_0`` () = - let cfg = testConfig "typecheck/sigs/version50" - singleVersionedNegTest cfg "5.0" "neg20" - - [] - let ``type check neg21`` () = singleNegTest (testConfig "typecheck/sigs") "neg21" - - [] - let ``type check neg23`` () = singleNegTest (testConfig "typecheck/sigs") "neg23" - [] let ``type check neg24 version 4_6`` () = let cfg = testConfig "typecheck/sigs/version46" @@ -2839,238 +2342,31 @@ module TypecheckTests = let cfg = { cfg with fsc_flags = cfg.fsc_flags.Replace("--nowarn:20", "") } singleVersionedNegTest cfg "preview" "neg24" - [] - let ``type check neg25`` () = singleNegTest (testConfig "typecheck/sigs") "neg25" - - [] - let ``type check neg26`` () = singleNegTest (testConfig "typecheck/sigs") "neg26" - [] let ``type check neg27`` () = singleNegTest (testConfig "typecheck/sigs") "neg27" - [] - let ``type check neg28`` () = singleNegTest (testConfig "typecheck/sigs") "neg28" - - [] - let ``type check neg29`` () = singleNegTest (testConfig "typecheck/sigs") "neg29" - - [] - let ``type check neg30`` () = singleNegTest (testConfig "typecheck/sigs") "neg30" - [] let ``type check neg31`` () = singleNegTest (testConfig "typecheck/sigs") "neg31" [] - let ``type check neg32`` () = singleNegTest (testConfig "typecheck/sigs") "neg32" - - [] - let ``type check neg33`` () = singleNegTest (testConfig "typecheck/sigs") "neg33" + let ``type check neg33`` () = singleNegTest (testConfig "typecheck/sigs") "neg33" [] - let ``type check neg34`` () = singleNegTest (testConfig "typecheck/sigs") "neg34" - - [] - let ``type check neg35`` () = singleNegTest (testConfig "typecheck/sigs") "neg35" - - [] - let ``type check neg36`` () = singleNegTest (testConfig "typecheck/sigs") "neg36" - - [] - let ``type check neg37`` () = singleNegTest (testConfig "typecheck/sigs") "neg37" - - [] - let ``type check neg37_a`` () = singleNegTest (testConfig "typecheck/sigs") "neg37_a" - - [] - let ``type check neg38`` () = singleNegTest (testConfig "typecheck/sigs") "neg38" - - [] - let ``type check neg39`` () = singleNegTest (testConfig "typecheck/sigs") "neg39" - - [] - let ``type check neg40`` () = singleNegTest (testConfig "typecheck/sigs") "neg40" - - [] - let ``type check neg41`` () = singleNegTest (testConfig "typecheck/sigs") "neg41" - - [] - let ``type check neg42`` () = singleNegTest (testConfig "typecheck/sigs") "neg42" - - [] - let ``type check neg43`` () = singleNegTest (testConfig "typecheck/sigs") "neg43" - - [] - let ``type check neg44`` () = singleNegTest (testConfig "typecheck/sigs") "neg44" + let ``type check neg43`` () = singleNegTest (testConfig "typecheck/sigs") "neg43" #if !DEBUG // requires release version of compiler to avoid very deep stacks [] let ``type check neg45`` () = singleNegTest (testConfig "typecheck/sigs") "neg45" #endif - [] - let ``type check neg46`` () = singleNegTest (testConfig "typecheck/sigs") "neg46" - - [] - let ``type check neg47`` () = singleNegTest (testConfig "typecheck/sigs") "neg47" - - [] - let ``type check neg48`` () = singleNegTest (testConfig "typecheck/sigs") "neg48" - [] let ``type check neg49`` () = singleNegTest (testConfig "typecheck/sigs") "neg49" [] - let ``type check neg50`` () = singleNegTest (testConfig "typecheck/sigs") "neg50" - - [] - let ``type check neg51`` () = singleNegTest (testConfig "typecheck/sigs") "neg51" - - [] - let ``type check neg52`` () = singleNegTest (testConfig "typecheck/sigs") "neg52" - - [] - let ``type check neg53`` () = singleNegTest (testConfig "typecheck/sigs") "neg53" - - [] - let ``type check neg54`` () = singleNegTest (testConfig "typecheck/sigs") "neg54" - - [] - let ``type check neg55`` () = singleNegTest (testConfig "typecheck/sigs") "neg55" - - [] - let ``type check neg56`` () = singleNegTest (testConfig "typecheck/sigs") "neg56" - - [] - let ``type check neg56_a`` () = singleNegTest (testConfig "typecheck/sigs") "neg56_a" - - [] - let ``type check neg56_b`` () = singleNegTest (testConfig "typecheck/sigs") "neg56_b" - - [] - let ``type check neg57`` () = singleNegTest (testConfig "typecheck/sigs") "neg57" - - [] - let ``type check neg58`` () = singleNegTest (testConfig "typecheck/sigs") "neg58" - - [] - let ``type check neg59`` () = singleNegTest (testConfig "typecheck/sigs") "neg59" - - [] - let ``type check neg60`` () = singleNegTest (testConfig "typecheck/sigs") "neg60" - - [] - let ``type check neg61`` () = singleNegTest (testConfig "typecheck/sigs") "neg61" - - [] - let ``type check neg62`` () = singleNegTest (testConfig "typecheck/sigs") "neg62" - - [] - let ``type check neg63`` () = singleNegTest (testConfig "typecheck/sigs") "neg63" - - [] - let ``type check neg64`` () = singleNegTest (testConfig "typecheck/sigs") "neg64" - - [] - let ``type check neg65`` () = singleNegTest (testConfig "typecheck/sigs") "neg65" - - [] - let ``type check neg66`` () = singleNegTest (testConfig "typecheck/sigs") "neg66" - - [] - let ``type check neg67`` () = singleNegTest (testConfig "typecheck/sigs") "neg67" - - [] - let ``type check neg68`` () = singleNegTest (testConfig "typecheck/sigs") "neg68" - - [] - let ``type check neg69`` () = singleNegTest (testConfig "typecheck/sigs") "neg69" - - [] - let ``type check neg70`` () = singleNegTest (testConfig "typecheck/sigs") "neg70" - - [] - let ``type check neg71`` () = singleNegTest (testConfig "typecheck/sigs") "neg71" - - [] - let ``type check neg72`` () = singleNegTest (testConfig "typecheck/sigs") "neg72" + let ``type check neg56_a`` () = singleNegTest (testConfig "typecheck/sigs") "neg56_a" [] - let ``type check neg73`` () = singleNegTest (testConfig "typecheck/sigs") "neg73" - - [] - let ``type check neg74`` () = singleNegTest (testConfig "typecheck/sigs") "neg74" - - [] - let ``type check neg75`` () = singleNegTest (testConfig "typecheck/sigs") "neg75" - - [] - let ``type check neg76`` () = singleNegTest (testConfig "typecheck/sigs") "neg76" - - [] - let ``type check neg77`` () = singleNegTest (testConfig "typecheck/sigs") "neg77" - - [] - let ``type check neg78`` () = singleNegTest (testConfig "typecheck/sigs") "neg78" - - [] - let ``type check neg79`` () = singleNegTest (testConfig "typecheck/sigs") "neg79" - - [] - let ``type check neg80`` () = singleNegTest (testConfig "typecheck/sigs") "neg80" - - [] - let ``type check neg81`` () = singleNegTest (testConfig "typecheck/sigs") "neg81" - - [] - let ``type check neg82`` () = singleNegTest (testConfig "typecheck/sigs") "neg82" - - [] - let ``type check neg83`` () = singleNegTest (testConfig "typecheck/sigs") "neg83" - - [] - let ``type check neg84`` () = singleNegTest (testConfig "typecheck/sigs") "neg84" - - [] - let ``type check neg85`` () = singleNegTest (testConfig "typecheck/sigs") "neg85" - - [] - let ``type check neg86`` () = singleNegTest (testConfig "typecheck/sigs") "neg86" - - [] - let ``type check neg88`` () = singleNegTest (testConfig "typecheck/sigs") "neg88" - - [] - let ``type check neg89`` () = singleNegTest (testConfig "typecheck/sigs") "neg89" - - [] - let ``type check neg90`` () = singleNegTest (testConfig "typecheck/sigs") "neg90" - - [] - let ``type check neg91`` () = singleNegTest (testConfig "typecheck/sigs") "neg91" - - [] - let ``type check neg92`` () = singleNegTest (testConfig "typecheck/sigs") "neg92" - - [] - let ``type check neg93`` () = singleNegTest (testConfig "typecheck/sigs") "neg93" - - [] - let ``type check neg94`` () = singleNegTest (testConfig "typecheck/sigs") "neg94" - - [] - let ``type check neg95`` () = singleNegTest (testConfig "typecheck/sigs") "neg95" - - [] - let ``type check neg96`` () = singleNegTest (testConfig "typecheck/sigs") "neg96" - - [] - let ``type check neg97`` () = singleNegTest (testConfig "typecheck/sigs") "neg97" - - [] - let ``type check neg98`` () = singleNegTest (testConfig "typecheck/sigs") "neg98" - - [] - let ``type check neg99`` () = singleNegTest (testConfig "typecheck/sigs") "neg99" + let ``type check neg94`` () = singleNegTest (testConfig "typecheck/sigs") "neg94" [] let ``type check neg100`` () = @@ -3078,179 +2374,14 @@ module TypecheckTests = let cfg = { cfg with fsc_flags = cfg.fsc_flags + " --warnon:3218" } singleNegTest cfg "neg100" - [] - let ``type check neg101`` () = singleNegTest (testConfig "typecheck/sigs") "neg101" - - [] - let ``type check neg102`` () = singleNegTest (testConfig "typecheck/sigs") "neg102" - - [] - let ``type check neg103`` () = singleNegTest (testConfig "typecheck/sigs") "neg103" - - [] - let ``type check neg104`` () = singleNegTest (testConfig "typecheck/sigs") "neg104" - - [] - let ``type check neg106`` () = singleNegTest (testConfig "typecheck/sigs") "neg106" - [] let ``type check neg107`` () = singleNegTest (testConfig "typecheck/sigs") "neg107" - - [] - let ``type check neg108`` () = singleNegTest (testConfig "typecheck/sigs") "neg108" - - [] - let ``type check neg109`` () = singleNegTest (testConfig "typecheck/sigs") "neg109" - - [] - let ``type check neg110`` () = singleNegTest (testConfig "typecheck/sigs") "neg110" - - [] - let ``type check neg111`` () = singleNegTest (testConfig "typecheck/sigs") "neg111" - - [] - let ``type check neg112`` () = singleNegTest (testConfig "typecheck/sigs") "neg112" - - [] - let ``type check neg113`` () = singleNegTest (testConfig "typecheck/sigs") "neg113" - - [] - let ``type check neg114`` () = singleNegTest (testConfig "typecheck/sigs") "neg114" - - [] - let ``type check neg115`` () = singleNegTest (testConfig "typecheck/sigs") "neg115" - + [] let ``type check neg116`` () = singleNegTest (testConfig "typecheck/sigs") "neg116" [] - let ``type check neg117`` () = singleNegTest (testConfig "typecheck/sigs") "neg117" - - [] - let ``type check neg118`` () = singleNegTest (testConfig "typecheck/sigs") "neg118" - - [] - let ``type check neg119a`` () = singleVersionedNegTest (testConfig "typecheck/sigs") "6.0" "neg119a" - - [] - let ``type check neg119b`` () = singleVersionedNegTest (testConfig "typecheck/sigs") "7.0" "neg119b" - - [] - let ``type check neg120`` () = singleNegTest (testConfig "typecheck/sigs") "neg120" - - [] - let ``type check neg121`` () = singleNegTest (testConfig "typecheck/sigs") "neg121" - - [] - let ``type check neg122`` () = singleNegTest (testConfig "typecheck/sigs") "neg122" - - [] - let ``type check neg123`` () = singleNegTest (testConfig "typecheck/sigs") "neg123" - - [] - let ``type check neg124`` () = singleNegTest (testConfig "typecheck/sigs") "neg124" - - [] - let ``type check neg125`` () = singleNegTest (testConfig "typecheck/sigs") "neg125" - - [] - let ``type check neg126`` () = singleNegTest (testConfig "typecheck/sigs") "neg126" - - [] - let ``type check neg127`` () = singleNegTest (testConfig "typecheck/sigs") "neg127" - - [] - let ``type check neg128`` () = singleNegTest (testConfig "typecheck/sigs") "neg128" - - [] - let ``type check neg129`` () = singleNegTest (testConfig "typecheck/sigs") "neg129" - - [] - let ``type check neg130`` () = singleNegTest (testConfig "typecheck/sigs") "neg130" - - [] - let ``type check neg131`` () = singleVersionedNegTest (testConfig "typecheck/sigs") "6.0" "neg131" - - [] - let ``type check neg132`` () = singleVersionedNegTest (testConfig "typecheck/sigs") "5.0" "neg132" - - [] - let ``type check neg133`` () = singleNegTest (testConfig "typecheck/sigs") "neg133" - - [] - let ``type check neg_anon_1`` () = singleNegTest (testConfig "typecheck/sigs") "neg_anon_1" - - [] - let ``type check neg_anon_2`` () = singleNegTest (testConfig "typecheck/sigs") "neg_anon_2" - - [] - let ``type check neg_issue_3752`` () = singleNegTest (testConfig "typecheck/sigs") "neg_issue_3752" - - [] - let ``type check neg_byref_1`` () = singleNegTest (testConfig "typecheck/sigs") "neg_byref_1" - - [] - let ``type check neg_byref_2`` () = singleNegTest (testConfig "typecheck/sigs") "neg_byref_2" - - [] - let ``type check neg_byref_3`` () = singleNegTest (testConfig "typecheck/sigs") "neg_byref_3" - - [] - let ``type check neg_byref_4`` () = singleNegTest (testConfig "typecheck/sigs") "neg_byref_4" - - [] - let ``type check neg_byref_5`` () = singleNegTest (testConfig "typecheck/sigs") "neg_byref_5" - - [] - let ``type check neg_byref_6`` () = singleNegTest (testConfig "typecheck/sigs") "neg_byref_6" - - [] - let ``type check neg_byref_7`` () = singleNegTest (testConfig "typecheck/sigs") "neg_byref_7" - - [] - let ``type check neg_byref_8`` () = singleNegTest (testConfig "typecheck/sigs") "neg_byref_8" - - [] - let ``type check neg_byref_10`` () = singleNegTest (testConfig "typecheck/sigs") "neg_byref_10" - - [] - let ``type check neg_byref_11`` () = singleNegTest (testConfig "typecheck/sigs") "neg_byref_11" - - [] - let ``type check neg_byref_12`` () = singleNegTest (testConfig "typecheck/sigs") "neg_byref_12" - - [] - let ``type check neg_byref_13`` () = singleNegTest (testConfig "typecheck/sigs") "neg_byref_13" - - [] - let ``type check neg_byref_14`` () = singleNegTest (testConfig "typecheck/sigs") "neg_byref_14" - - [] - let ``type check neg_byref_15`` () = singleNegTest (testConfig "typecheck/sigs") "neg_byref_15" - - [] - let ``type check neg_byref_16`` () = singleNegTest (testConfig "typecheck/sigs") "neg_byref_16" - - [] - let ``type check neg_byref_17`` () = singleNegTest (testConfig "typecheck/sigs") "neg_byref_17" - - [] - let ``type check neg_byref_18`` () = singleNegTest (testConfig "typecheck/sigs") "neg_byref_18" - - [] - let ``type check neg_byref_19`` () = singleNegTest (testConfig "typecheck/sigs") "neg_byref_19" - - [] - let ``type check neg_byref_20`` () = singleNegTest (testConfig "typecheck/sigs") "neg_byref_20" - - [] - let ``type check neg_byref_21`` () = singleNegTest (testConfig "typecheck/sigs") "neg_byref_21" - - [] - let ``type check neg_byref_22`` () = singleNegTest (testConfig "typecheck/sigs") "neg_byref_22" - - [] - let ``type check neg_byref_23`` () = singleNegTest (testConfig "typecheck/sigs") "neg_byref_23" + let ``type check neg117`` () = singleNegTest (testConfig "typecheck/sigs") "neg117" [] module FscTests = @@ -3370,40 +2501,4 @@ namespace CST.RI.Anshun fileVersionInfo.ProductVersion |> Assert.areEqual expected -#endif - -#if !NETCOREAPP -[] -module OverloadResolution = - module ``fsharpqa migrated tests`` = - let [] ``Conformance\Expressions\SyntacticSugar (E_Slices01_fs)`` () = singleNegTest (testConfig "conformance/expressions/syntacticsugar") "E_Slices01" - let [] ``Conformance\Expressions\Type-relatedExpressions (E_RigidTypeAnnotation03_fsx)`` () = singleNegTest (testConfig "conformance/expressions/type-relatedexpressions") "E_RigidTypeAnnotation03" - let [] ``Conformance\Inference (E_OneTypeVariable03_fs)`` () = singleNegTest (testConfig "conformance/inference") "E_OneTypeVariable03" - let [] ``Conformance\Inference (E_OneTypeVariable03rec_fs)`` () = singleNegTest (testConfig "conformance/inference") "E_OneTypeVariable03rec" - let [] ``Conformance\Inference (E_TwoDifferentTypeVariablesGen00_fs)`` () = singleNegTest (testConfig "conformance/inference") "E_TwoDifferentTypeVariablesGen00" - let [] ``Conformance\Inference (E_TwoDifferentTypeVariables01_fs)`` () = singleNegTest (testConfig "conformance/inference") "E_TwoDifferentTypeVariables01" - let [] ``Conformance\Inference (E_TwoDifferentTypeVariables01rec_fs)`` () = singleNegTest (testConfig "conformance/inference") "E_TwoDifferentTypeVariables01rec" - let [] ``Conformance\Inference (E_TwoDifferentTypeVariablesGen00rec_fs)`` () = singleNegTest (testConfig "conformance/inference") "E_TwoDifferentTypeVariablesGen00rec" - let [] ``Conformance\Inference (E_TwoEqualTypeVariables02_fs)`` () = singleNegTest (testConfig "conformance/inference") "E_TwoEqualTypeVariables02" - let [] ``Conformance\Inference (E_TwoEqualYypeVariables02rec_fs)`` () = singleNegTest (testConfig "conformance/inference") "E_TwoEqualYypeVariables02rec" - let [] ``Conformance\Inference (E_LeftToRightOverloadResolution01_fs)`` () = singleNegTest (testConfig "conformance/inference") "E_LeftToRightOverloadResolution01" - let [] ``Conformance\WellFormedness (E_Clashing_Values_in_AbstractClass01_fs)`` () = singleNegTest (testConfig "conformance/wellformedness") "E_Clashing_Values_in_AbstractClass01" - let [] ``Conformance\WellFormedness (E_Clashing_Values_in_AbstractClass03_fs)`` () = singleNegTest (testConfig "conformance/wellformedness") "E_Clashing_Values_in_AbstractClass03" - let [] ``Conformance\WellFormedness (E_Clashing_Values_in_AbstractClass04_fs)`` () = singleNegTest (testConfig "conformance/wellformedness") "E_Clashing_Values_in_AbstractClass04" - // note: this test still exist in fsharpqa to assert the compiler doesn't crash - // the part of the code generating a flaky error due to https://github.com/dotnet/fsharp/issues/6725 - // is elided here to focus on overload resolution error messages - let [] ``Conformance\LexicalAnalysis\SymbolicOperators (E_LessThanDotOpenParen001_fs)`` () = singleNegTest (testConfig "conformance/lexicalanalysis") "E_LessThanDotOpenParen001" - - module ``error messages using BCL``= - let [] ``neg_System_Convert_ToString_OverloadList``() = singleNegTest (testConfig "typecheck/overloads") "neg_System.Convert.ToString.OverloadList" - let [] ``neg_System_Threading_Tasks_Task_Run_OverloadList``() = singleNegTest (testConfig "typecheck/overloads") "neg_System.Threading.Tasks.Task.Run.OverloadList" - let [] ``neg_System_Drawing_Graphics_DrawRectangleOverloadList_fsx``() = singleNegTest (testConfig "typecheck/overloads") "neg_System.Drawing.Graphics.DrawRectangleOverloadList" - - module ``ad hoc code overload error messages``= - let [] ``neg_many_many_overloads`` () = singleNegTest (testConfig "typecheck/overloads") "neg_many_many_overloads" - let [] ``neg_interface_generics`` () = singleNegTest (testConfig "typecheck/overloads") "neg_interface_generics" - let [] ``neg_known_return_type_and_known_type_arguments`` () = singleNegTest (testConfig "typecheck/overloads") "neg_known_return_type_and_known_type_arguments" - let [] ``neg_generic_known_argument_types`` () = singleNegTest (testConfig "typecheck/overloads") "neg_generic_known_argument_types" - let [] ``neg_tupled_arguments`` () = singleNegTest (testConfig "typecheck/overloads") "neg_tupled_arguments" -#endif +#endif \ No newline at end of file diff --git a/tests/service/ProjectAnalysisTests.fs b/tests/service/ProjectAnalysisTests.fs index 8b9f6f9d951..a64bc715582 100644 --- a/tests/service/ProjectAnalysisTests.fs +++ b/tests/service/ProjectAnalysisTests.fs @@ -5732,13 +5732,17 @@ let checkContentAsScript content = [] let ``References from #r nuget are included in script project options`` () = - let checkResults = checkContentAsScript """ + let isMacos = System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.OSX) + if isMacos then + Assert.Inconclusive("This test is failing on MacOS VMs now") + else + let checkResults = checkContentAsScript """ #i "nuget:https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" #r "nuget: Dapper" """ - let assemblyNames = - checkResults.ProjectContext.GetReferencedAssemblies() - |> Seq.choose (fun f -> f.FileName |> Option.map Path.GetFileName) - |> Seq.distinct - printfn "%s" (assemblyNames |> String.concat "\n") - assemblyNames |> should contain "Dapper.dll" + let assemblyNames = + checkResults.ProjectContext.GetReferencedAssemblies() + |> Seq.choose (fun f -> f.FileName |> Option.map Path.GetFileName) + |> Seq.distinct + printfn "%s" (assemblyNames |> String.concat "\n") + assemblyNames |> should contain "Dapper.dll" diff --git a/tests/service/ScriptOptionsTests.fs b/tests/service/ScriptOptionsTests.fs index 998120a81d4..df734e04fd1 100644 --- a/tests/service/ScriptOptionsTests.fs +++ b/tests/service/ScriptOptionsTests.fs @@ -47,23 +47,27 @@ let ``can generate options for different frameworks regardless of execution envi [] [] let ``can resolve nuget packages to right target framework for different frameworks regardless of execution environment``(assumeNetFx, useSdk, flags) = - let path = Path.GetTempPath() - let file = tryCreateTemporaryFileName () + ".fsx" - let tempFile = Path.Combine(path, file) - let scriptSource = """ + let isMacos = System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.OSX) + if isMacos then + Assert.Inconclusive("This test is failing on MacOS VMs now") + else + let path = Path.GetTempPath() + let file = tryCreateTemporaryFileName () + ".fsx" + let tempFile = Path.Combine(path, file) + let scriptSource = """ #r "nuget: FSharp.Data, 3.3.3" open System let pi = Math.PI """ - let options, errors = - checker.GetProjectOptionsFromScript(tempFile, SourceText.ofString scriptSource, assumeDotNetFramework = assumeNetFx, useSdkRefs = useSdk, otherFlags = flags) - |> Async.RunImmediate - match errors with - | [] -> () - | errors -> failwithf "Error while parsing script with assumeDotNetFramework:%b, useSdkRefs:%b, and otherFlags:%A:\n%A" assumeNetFx useSdk flags errors - let expectedReferenceText = (if assumeNetFx then "net45" else "netstandard2.0") - let found = options.OtherOptions |> Array.exists (fun s -> s.Contains(expectedReferenceText) && s.Contains("FSharp.Data.dll")) - Assert.IsTrue(found) + let options, errors = + checker.GetProjectOptionsFromScript(tempFile, SourceText.ofString scriptSource, assumeDotNetFramework = assumeNetFx, useSdkRefs = useSdk, otherFlags = flags) + |> Async.RunImmediate + match errors with + | [] -> () + | errors -> failwithf "Error while parsing script with assumeDotNetFramework:%b, useSdkRefs:%b, and otherFlags:%A:\n%A" assumeNetFx useSdk flags errors + let expectedReferenceText = (if assumeNetFx then "net45" else "netstandard2.0") + let found = options.OtherOptions |> Array.exists (fun s -> s.Contains(expectedReferenceText) && s.Contains("FSharp.Data.dll")) + Assert.IsTrue(found) // This test atempts to use a bad SDK number 666.666.666 //