提交 86c023b2 编写于 作者: N ncave 提交者: Kevin Ransom (msft)

Fixed FCS netcore tests (#4180)

上级 df20c321
......@@ -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
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp1.0</TargetFramework>
<DefineConstants>$(DefineConstants);DOTNETCORE;FX_ATLEAST_45;FX_ATLEAST_PORTABLE;FX_NO_RUNTIMEENVIRONMENT;FX_RESHAPED_REFLECTION;TODO_REWORK_ASSEMBLY_LOAD;</DefineConstants>
<TargetFramework>netcoreapp2.0</TargetFramework>
<DefineConstants>$(DefineConstants);DOTNETCORE</DefineConstants>
<DefineConstants>$(DefineConstants);FX_ATLEAST_45</DefineConstants>
<DefineConstants>$(DefineConstants);FX_ATLEAST_PORTABLE</DefineConstants>
<DefineConstants>$(DefineConstants);FX_NO_RUNTIMEENVIRONMENT</DefineConstants>
<DefineConstants>$(DefineConstants);FX_RESHAPED_REFLECTION</DefineConstants>
<DefineConstants>$(DefineConstants);NO_EXTENSIONTYPING</DefineConstants>
<DefineConstants>$(DefineConstants);TODO_REWORK_ASSEMBLY_LOAD</DefineConstants>
<NoWarn>$(NoWarn);44;</NoWarn>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<DelaySign>true</DelaySign>
......@@ -36,25 +42,21 @@
<!--<Compile Include="../service/ProjectAnalysisTests.fs">
<Link>ProjectAnalysisTests.fs</Link>
</Compile>-->
<Compile Include="../../tests/service/Program.fs">
<Link>Program.fs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="../FSharp.Compiler.Service.netstandard/FSharp.Compiler.Service.netstandard.fsproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.8.0" />
<PackageReference Include="NUnitLite" Version="3.6.1" />
<PackageReference Include="NUnit" Version="3.6.1" />
<PackageReference Include="FSharp.Core" Version="4.1.*" PrivateAssets="All" />
<PackageReference Include="System.Runtime" Version="4.3.0" />
<PackageReference Include="System.Reflection.Emit" Version="4.3.0" />
<PackageReference Include="System.Reflection.Metadata" Version="1.4.1" />
<PackageReference Include="System.Reflection.TypeExtensions" Version="4.3.0" />
<PackageReference Include="System.Runtime.Loader" Version="4.3.0" />
<PackageReference Include="Dotnet.ProjInfo" Version="0.5.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
<PackageReference Include="NUnit" Version="3.9.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.9.0" />
<PackageReference Include="Dotnet.ProjInfo" Version="0.9.0" />
</ItemGroup>
<Target Name="PrecompileScript" BeforeTargets="BeforeBuild">
<Exec Command="dotnet restore &quot;$(MSBuildProjectDirectory)/../../tests/projects/Sample_NETCoreSDK_FSharp_Library_netstandard1.6/Sample_NETCoreSDK_FSharp_Library_netstandard1.6.fsproj&quot;" />
<Exec Command="dotnet build &quot;$(MSBuildProjectDirectory)/../../tests/projects/Sample_NETCoreSDK_FSharp_Library_netstandard1.6/Sample_NETCoreSDK_FSharp_Library_netstandard1.6.fsproj&quot;" />
<Exec Command="dotnet restore &quot;$(MSBuildProjectDirectory)/../../tests/projects/Sample_NETCoreSDK_FSharp_Library_netstandard2_0/Sample_NETCoreSDK_FSharp_Library_netstandard2_0.fsproj&quot;" />
<Exec Command="dotnet build &quot;$(MSBuildProjectDirectory)/../../tests/projects/Sample_NETCoreSDK_FSharp_Library_netstandard2_0/Sample_NETCoreSDK_FSharp_Library_netstandard2_0.fsproj&quot;" />
</Target>
</Project>
\ No newline at end of file
<Project Sdk="FSharp.NET.Sdk;Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard1.6</TargetFramework>
<DebugType>portable</DebugType>
<!-- <DebugType>portable</DebugType> -->
</PropertyGroup>
<ItemGroup>
<Compile Include="Library1.fs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="FSharp.Core" Version="4.1.*" />
<PackageReference Include="FSharp.NET.Sdk" Version="1.0.*" PrivateAssets="All" />
</ItemGroup>
</Project>
\ No newline at end of file
namespace Sample_NETCoreSDK_FSharp_Library_netstandard2_0
type Class1() =
member this.X = "F#"
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="Library1.fs" />
</ItemGroup>
</Project>
\ No newline at end of file
......@@ -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"
......
......@@ -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
......
......@@ -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
()
open System
open System.IO
open System.Reflection
open NUnitLite
open NUnit.Common
type private TypeInThisAssembly = class end
[<EntryPoint>]
let main argv =
printfn "Dotnet Core NUnit Tests..."
let writer = new ExtendedTextWrapper(Console.Out)
let runner = new AutoRun(typeof<TypeInThisAssembly>.GetTypeInfo().Assembly)
runner.Execute(argv, writer, Console.In)
0
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册