From c3b083e65d5e481e77d442ca6750e0fff5bf2c6d Mon Sep 17 00:00:00 2001
From: ncave <777696+ncave@users.noreply.github.com>
Date: Fri, 5 Jan 2018 09:36:53 -0800
Subject: [PATCH] Fixed FCS netcore tests
---
.gitignore | 2 ++
...harp.Compiler.Service.Tests.netcore.fsproj | 32 ++++++++++---------
...reSDK_FSharp_Library_netstandard1.6.fsproj | 8 ++---
.../Library1.fs | 4 +++
...reSDK_FSharp_Library_netstandard2_0.fsproj | 8 +++++
tests/service/Common.fs | 7 ++--
tests/service/EditorTests.fs | 12 ++-----
tests/service/PerfTests.fs | 9 +++---
tests/service/Program.fs | 10 +-----
9 files changed, 44 insertions(+), 48 deletions(-)
create mode 100644 tests/projects/Sample_NETCoreSDK_FSharp_Library_netstandard2_0/Library1.fs
create mode 100644 tests/projects/Sample_NETCoreSDK_FSharp_Library_netstandard2_0/Sample_NETCoreSDK_FSharp_Library_netstandard2_0.fsproj
diff --git a/.gitignore b/.gitignore
index 7450e14a294..236ddf853f2 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 71f5341bb71..b9d44ad919f 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 aba132e319d..abac283cf0c 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 00000000000..0eba466d884
--- /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 00000000000..926080b65b5
--- /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 d038ff178a1..e3378e77b43 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 d3e7c724509..f0207609b26 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 6a162ced54a..dcc8a453557 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 45d9a343374..c94e2a49931 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