diff --git a/.gitignore b/.gitignore index 7450e14a29..236ddf853f 100644 --- a/.gitignore +++ b/.gitignore @@ -125,3 +125,5 @@ tests/fsharpqa/testenv/bin/System.ValueTuple.dll /tests/fcs/ /fcs/.paket/Paket.Restore.targets msbuild.binlog +/fcs/FSharp.Compiler.Service.netstandard/*.fs +/fcs/FSharp.Compiler.Service.netstandard/*.fsi diff --git a/fcs/FSharp.Compiler.Service.Tests.netcore/FSharp.Compiler.Service.Tests.netcore.fsproj b/fcs/FSharp.Compiler.Service.Tests.netcore/FSharp.Compiler.Service.Tests.netcore.fsproj index 71f5341bb7..b9d44ad919 100644 --- a/fcs/FSharp.Compiler.Service.Tests.netcore/FSharp.Compiler.Service.Tests.netcore.fsproj +++ b/fcs/FSharp.Compiler.Service.Tests.netcore/FSharp.Compiler.Service.Tests.netcore.fsproj @@ -1,7 +1,13 @@  - netcoreapp1.0 - $(DefineConstants);DOTNETCORE;FX_ATLEAST_45;FX_ATLEAST_PORTABLE;FX_NO_RUNTIMEENVIRONMENT;FX_RESHAPED_REFLECTION;TODO_REWORK_ASSEMBLY_LOAD; + netcoreapp2.0 + $(DefineConstants);DOTNETCORE + $(DefineConstants);FX_ATLEAST_45 + $(DefineConstants);FX_ATLEAST_PORTABLE + $(DefineConstants);FX_NO_RUNTIMEENVIRONMENT + $(DefineConstants);FX_RESHAPED_REFLECTION + $(DefineConstants);NO_EXTENSIONTYPING + $(DefineConstants);TODO_REWORK_ASSEMBLY_LOAD $(NoWarn);44; true true @@ -36,25 +42,21 @@ + + Program.fs + - - - - - - - - - - - + + + + - - + + \ No newline at end of file diff --git a/tests/projects/Sample_NETCoreSDK_FSharp_Library_netstandard1.6/Sample_NETCoreSDK_FSharp_Library_netstandard1.6.fsproj b/tests/projects/Sample_NETCoreSDK_FSharp_Library_netstandard1.6/Sample_NETCoreSDK_FSharp_Library_netstandard1.6.fsproj index aba132e319..abac283cf0 100644 --- a/tests/projects/Sample_NETCoreSDK_FSharp_Library_netstandard1.6/Sample_NETCoreSDK_FSharp_Library_netstandard1.6.fsproj +++ b/tests/projects/Sample_NETCoreSDK_FSharp_Library_netstandard1.6/Sample_NETCoreSDK_FSharp_Library_netstandard1.6.fsproj @@ -1,13 +1,9 @@ - + netstandard1.6 - portable + - - - - \ No newline at end of file diff --git a/tests/projects/Sample_NETCoreSDK_FSharp_Library_netstandard2_0/Library1.fs b/tests/projects/Sample_NETCoreSDK_FSharp_Library_netstandard2_0/Library1.fs new file mode 100644 index 0000000000..0eba466d88 --- /dev/null +++ b/tests/projects/Sample_NETCoreSDK_FSharp_Library_netstandard2_0/Library1.fs @@ -0,0 +1,4 @@ +namespace Sample_NETCoreSDK_FSharp_Library_netstandard2_0 + +type Class1() = + member this.X = "F#" diff --git a/tests/projects/Sample_NETCoreSDK_FSharp_Library_netstandard2_0/Sample_NETCoreSDK_FSharp_Library_netstandard2_0.fsproj b/tests/projects/Sample_NETCoreSDK_FSharp_Library_netstandard2_0/Sample_NETCoreSDK_FSharp_Library_netstandard2_0.fsproj new file mode 100644 index 0000000000..926080b65b --- /dev/null +++ b/tests/projects/Sample_NETCoreSDK_FSharp_Library_netstandard2_0/Sample_NETCoreSDK_FSharp_Library_netstandard2_0.fsproj @@ -0,0 +1,8 @@ + + + netstandard2.0 + + + + + \ No newline at end of file diff --git a/tests/service/Common.fs b/tests/service/Common.fs index d038ff178a..e3378e77b4 100644 --- a/tests/service/Common.fs +++ b/tests/service/Common.fs @@ -29,9 +29,10 @@ let readRefs (folder : string) (projectFile: string) = let exitCode = p.ExitCode exitCode, () + let projFilePath = Path.Combine(folder, projectFile) let runCmd exePath args = runProcess folder exePath (args |> String.concat " ") let msbuildExec = Dotnet.ProjInfo.Inspect.dotnetMsbuild runCmd - let result = Dotnet.ProjInfo.Inspect.getProjectInfo ignore msbuildExec Dotnet.ProjInfo.Inspect.getFscArgs [] projectFile + let result = Dotnet.ProjInfo.Inspect.getProjectInfo ignore msbuildExec Dotnet.ProjInfo.Inspect.getFscArgs [] projFilePath match result with | Ok(Dotnet.ProjInfo.Inspect.GetResult.FscArgs x) -> x @@ -101,8 +102,8 @@ let fsCoreDefaultReference() = let mkStandardProjectReferences () = #if DOTNETCORE - let file = "Sample_NETCoreSDK_FSharp_Library_netstandard1.6.fsproj" - let projDir = Path.Combine(__SOURCE_DIRECTORY__, "../projects/Sample_NETCoreSDK_FSharp_Library_netstandard1.6") + let file = "Sample_NETCoreSDK_FSharp_Library_netstandard2_0.fsproj" + let projDir = Path.Combine(__SOURCE_DIRECTORY__, "../projects/Sample_NETCoreSDK_FSharp_Library_netstandard2_0") readRefs projDir file #else [ yield sysLib "mscorlib" diff --git a/tests/service/EditorTests.fs b/tests/service/EditorTests.fs index d3e7c72450..f0207609b2 100644 --- a/tests/service/EditorTests.fs +++ b/tests/service/EditorTests.fs @@ -36,21 +36,12 @@ open Microsoft.FSharp.Compiler.SourceCodeServices open FSharp.Compiler.Service.Tests.Common let stringMethods = -#if DOTNETCORE - ["Chars"; "CompareTo"; "Contains"; "CopyTo"; "EndsWith"; "Equals"; - "GetHashCode"; "GetType"; "IndexOf"; - "IndexOfAny"; "Insert"; "LastIndexOf"; "LastIndexOfAny"; - "Length"; "PadLeft"; "PadRight"; "Remove"; "Replace"; "Split"; - "StartsWith"; "Substring"; "ToCharArray"; "ToLower"; "ToLowerInvariant"; - "ToString"; "ToUpper"; "ToUpperInvariant"; "Trim"; "TrimEnd"; "TrimStart"] -#else ["Chars"; "Clone"; "CompareTo"; "Contains"; "CopyTo"; "EndsWith"; "Equals"; "GetEnumerator"; "GetHashCode"; "GetType"; "GetTypeCode"; "IndexOf"; "IndexOfAny"; "Insert"; "IsNormalized"; "LastIndexOf"; "LastIndexOfAny"; "Length"; "Normalize"; "PadLeft"; "PadRight"; "Remove"; "Replace"; "Split"; "StartsWith"; "Substring"; "ToCharArray"; "ToLower"; "ToLowerInvariant"; "ToString"; "ToUpper"; "ToUpperInvariant"; "Trim"; "TrimEnd"; "TrimStart"] -#endif let input = """ @@ -582,7 +573,8 @@ let test3 = System.Text.RegularExpressions.RegexOptions.Compiled |> Array.choose(fun s -> match s.Symbol with :? FSharpEntity as e when e.IsEnum -> Some e | _ -> None) |> Array.distinct |> Array.map(fun e -> (e.DisplayName, e.FSharpFields - |> Seq.map(fun f -> f.Name, f.LiteralValue ) + |> Seq.sortBy (fun f -> match f.LiteralValue with None -> -1 | Some x -> unbox x) + |> Seq.map (fun f -> f.Name, f.LiteralValue) |> Seq.toList)) enums |> shouldEqual diff --git a/tests/service/PerfTests.fs b/tests/service/PerfTests.fs index 6a162ced54..dcc8a45355 100644 --- a/tests/service/PerfTests.fs +++ b/tests/service/PerfTests.fs @@ -65,16 +65,15 @@ let ``Test request for parse and check doesn't check whole project`` () = let pE, tE = FSharpChecker.GlobalForegroundParseCountStatistic, FSharpChecker.GlobalForegroundTypeCheckCountStatistic (pE - pD) |> shouldEqual 0 (tE - tD) |> shouldEqual 1 - (backgroundParseCount.Value <= 8) |> shouldEqual true // but note, the project does not get reparsed - (backgroundCheckCount.Value <= 8) |> shouldEqual true // only two extra typechecks of files + (backgroundParseCount.Value <= 9) |> shouldEqual true // but note, the project does not get reparsed + (backgroundCheckCount.Value <= 9) |> shouldEqual true // only two extra typechecks of files // A subsequent ParseAndCheck of identical source code doesn't do any more anything let checkResults2 = checker.ParseAndCheckFileInProject(Project1.fileNames.[7], 0, Project1.fileSources2.[7], Project1.options) |> Async.RunSynchronously let pF, tF = FSharpChecker.GlobalForegroundParseCountStatistic, FSharpChecker.GlobalForegroundTypeCheckCountStatistic (pF - pE) |> shouldEqual 0 // note, no new parse of the file (tF - tE) |> shouldEqual 0 // note, no new typecheck of the file - (backgroundParseCount.Value <= 8) |> shouldEqual true // but note, the project does not get reparsed - (backgroundCheckCount.Value <= 8) |> shouldEqual true // only two extra typechecks of files - + (backgroundParseCount.Value <= 9) |> shouldEqual true // but note, the project does not get reparsed + (backgroundCheckCount.Value <= 9) |> shouldEqual true // only two extra typechecks of files () diff --git a/tests/service/Program.fs b/tests/service/Program.fs index 45d9a34337..c94e2a4993 100644 --- a/tests/service/Program.fs +++ b/tests/service/Program.fs @@ -1,14 +1,6 @@ open System -open System.IO -open System.Reflection -open NUnitLite -open NUnit.Common - -type private TypeInThisAssembly = class end [] let main argv = printfn "Dotnet Core NUnit Tests..." - let writer = new ExtendedTextWrapper(Console.Out) - let runner = new AutoRun(typeof.GetTypeInfo().Assembly) - runner.Execute(argv, writer, Console.In) + 0 \ No newline at end of file