Skip to content

Commit 84e5756

Browse files
committed
Added ProjectAnalysisTests
1 parent 5a028e0 commit 84e5756

File tree

3 files changed

+50
-11
lines changed

3 files changed

+50
-11
lines changed

tests/FSharp.Compiler.Service.Tests.netcore/project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
"../service/TokenizerTests.fs",
1515
"../service/PerfTests.fs",
1616
"../service/InteractiveCheckerTests.fs",
17+
"../service/ProjectAnalysisTests.fs",
1718
"Program.fs",
1819
],
1920
"excludeFiles": [
20-
"../service/ProjectAnalysisTests.fs",
2121
"../service/FscTests.fs",
2222
"../service/ProjectOptionsTests.fs",
2323
"../service/FileSystemTests.fs",

tests/service/Common.fs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,12 @@ let mkProjectCommandLineArgs (dllName, fileNames) =
7878
let references =
7979
#if TODO_REWORK_ASSEMBLY_LOAD
8080
[ yield typeof<System.Object>.Assembly.Location; // mscorlib
81+
yield typeof<System.Console>.Assembly.Location; // System.Console
8182
yield typeof<System.ComponentModel.DefaultValueAttribute>.Assembly.Location; // System.Runtime
83+
yield typeof<System.ComponentModel.PropertyChangedEventArgs>.Assembly.Location; // System.ObjectModel
8284
yield typeof<System.IO.BufferedStream>.Assembly.Location; // System.IO
8385
yield typeof<System.Linq.Enumerable>.Assembly.Location; // System.Linq
86+
yield typeof<System.Xml.Linq.XDocument>.Assembly.Location; // System.Xml.Linq
8487
yield typeof<System.Net.WebRequest>.Assembly.Location; // System.Net.Requests
8588
yield typeof<System.Numerics.BigInteger>.Assembly.Location; // System.Runtime.Numerics
8689
yield typeof<System.Threading.Tasks.TaskExtensions>.Assembly.Location; // System.Threading.Tasks
@@ -112,7 +115,7 @@ let parseAndCheckScript (file, input) =
112115

113116
#if TODO_REWORK_ASSEMBLY_LOAD
114117
let dllName = Path.ChangeExtension(file, ".dll")
115-
let projName = Path.ChangeExtension(file, ".fsproj")
118+
let projName = Path.ChangeExtension(file, ".fsproj")
116119
let args = mkProjectCommandLineArgs (dllName, [file])
117120
let projectOptions = checker.GetProjectOptionsFromCommandLineArgs (projName, args)
118121
#else

tests/service/ProjectAnalysisTests.fs

Lines changed: 45 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2185,7 +2185,9 @@ let ``Test Project13 all symbols`` () =
21852185
["type System.IComparable";
21862186
"type System.IFormattable";
21872187
"type System.IConvertible";
2188+
#if !DOTNETCORE
21882189
"type System.Runtime.Serialization.ISerializable";
2190+
#endif
21892191
"type System.IComparable<System.DateTime>";
21902192
"type System.IEquatable<System.DateTime>"])
21912193

@@ -3587,14 +3589,22 @@ let _ = XmlProvider<"<root><value>1</value><value>3</value></root>">.GetSample()
35873589
yield @"-r:" + sysLib "System.Xml.Linq" |]
35883590
let options = checker.GetProjectOptionsFromCommandLineArgs (projFileName, args)
35893591

3592+
#if DOTNETCORE
3593+
[<Test; Ignore "Disabled until FSharp.Data.dll is build for dotnet core.">]
3594+
#else
35903595
[<Test>]
3596+
#endif
35913597
let ``Test Project25 whole project errors`` () =
35923598
let wholeProjectResults = checker.ParseAndCheckProject(Project25.options) |> Async.RunSynchronously
35933599
for e in wholeProjectResults.Errors do
35943600
printfn "Project25 error: <<<%s>>>" e.Message
35953601
wholeProjectResults.Errors.Length |> shouldEqual 0
35963602

3603+
#if DOTNETCORE
3604+
[<Test; Ignore "Disabled until FSharp.Data.dll is build for dotnet core.">]
3605+
#else
35973606
[<Test>]
3607+
#endif
35983608
let ``Test symbol uses of type-provided members`` () =
35993609
let wholeProjectResults = checker.ParseAndCheckProject(Project25.options) |> Async.RunSynchronously
36003610
let backgroundParseResults1, backgroundTypedParse1 =
@@ -3647,7 +3657,11 @@ let ``Test symbol uses of type-provided members`` () =
36473657

36483658
usesOfGetSampleSymbol |> shouldEqual [|("file1", ((5, 8), (5, 25))); ("file1", ((10, 8), (10, 78)))|]
36493659

3660+
#if DOTNETCORE
3661+
[<Test; Ignore "Disabled until FSharp.Data.dll is build for dotnet core.">]
3662+
#else
36503663
[<Test>]
3664+
#endif
36513665
let ``Test symbol uses of type-provided types`` () =
36523666
let wholeProjectResults = checker.ParseAndCheckProject(Project25.options) |> Async.RunSynchronously
36533667
let backgroundParseResults1, backgroundTypedParse1 =
@@ -4074,9 +4088,14 @@ let ``Test project31 C# type attributes`` () =
40744088
yield output.Replace("\r\n", "\n").Replace("\n", "") ]
40754089
|> set
40764090
|> shouldEqual
4077-
(set ["(DebuggerTypeProxyAttribute, [], [])";
4078-
"""(DebuggerDisplayAttribute, [(type Microsoft.FSharp.Core.string, "Count = {Count}")], [])""";
4079-
"""(DefaultMemberAttribute, [(type Microsoft.FSharp.Core.string, "Item")], [])"""])
4091+
(set [
4092+
"(DebuggerTypeProxyAttribute, [], [])";
4093+
"""(DebuggerDisplayAttribute, [(type Microsoft.FSharp.Core.string, "Count = {Count}")], [])""";
4094+
"""(DefaultMemberAttribute, [(type Microsoft.FSharp.Core.string, "Item")], [])""";
4095+
#if DOTNETCORE
4096+
"(__DynamicallyInvokableAttribute, [], [])";
4097+
#endif
4098+
])
40804099

40814100
[<Test>]
40824101
let ``Test project31 C# method attributes`` () =
@@ -4096,8 +4115,11 @@ let ``Test project31 C# method attributes`` () =
40964115
objMethodsAttributes
40974116
|> set
40984117
|> shouldEqual
4099-
(set ["(SecuritySafeCriticalAttribute, [], [])";
4100-
"(CLSCompliantAttribute, [(type Microsoft.FSharp.Core.bool, false)], [])"])
4118+
(set [
4119+
#if !DOTNETCORE
4120+
"(SecuritySafeCriticalAttribute, [], [])";
4121+
#endif
4122+
"(CLSCompliantAttribute, [(type Microsoft.FSharp.Core.bool, false)], [])"])
41014123

41024124
[<Test>]
41034125
let ``Test project31 Format C# type attributes`` () =
@@ -4112,7 +4134,11 @@ let ``Test project31 Format C# type attributes`` () =
41124134
|> shouldEqual
41134135
(set ["[<DebuggerTypeProxyAttribute (typeof<Mscorlib_CollectionDebugView<>>)>]";
41144136
"""[<DebuggerDisplayAttribute ("Count = {Count}")>]""";
4115-
"""[<Reflection.DefaultMemberAttribute ("Item")>]"""])
4137+
"""[<Reflection.DefaultMemberAttribute ("Item")>]""";
4138+
#if DOTNETCORE
4139+
"[<__DynamicallyInvokableAttribute ()>]";
4140+
#endif
4141+
])
41164142

41174143
[<Test>]
41184144
let ``Test project31 Format C# method attributes`` () =
@@ -4130,7 +4156,10 @@ let ``Test project31 Format C# method attributes`` () =
41304156
|> set
41314157
|> shouldEqual
41324158
(set ["[<CLSCompliantAttribute (false)>]";
4133-
"[<Security.SecuritySafeCriticalAttribute ()>]"])
4159+
#if !DOTNETCORE
4160+
"[<Security.SecuritySafeCriticalAttribute ()>]";
4161+
#endif
4162+
])
41344163

41354164
module Project32 =
41364165
open System.IO
@@ -4398,8 +4427,15 @@ module Project35b =
43984427
let cleanFileName a = if a = fileName1 then "file1" else "??"
43994428

44004429
let fileNames = [fileName1]
4401-
let options = checker.GetProjectOptionsFromScript(fileName1, fileSource1) |> Async.RunSynchronously
4402-
4430+
#if TODO_REWORK_ASSEMBLY_LOAD
4431+
let projPath = Path.ChangeExtension(fileName1, ".fsproj")
4432+
let dllPath = Path.ChangeExtension(fileName1, ".dll")
4433+
let args = mkProjectCommandLineArgs(dllPath, fileNames)
4434+
let args2 = Array.append args [| "-r: notexist.dll" |]
4435+
let options = checker.GetProjectOptionsFromCommandLineArgs (projPath, args2)
4436+
#else
4437+
let options = checker.GetProjectOptionsFromScript(fileName1, fileSource1) |> Async.RunSynchronously
4438+
#endif
44034439

44044440
[<Test>]
44054441
let ``Test project35b Dependency files for ParseFileInProject`` () =

0 commit comments

Comments
 (0)