-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move data folder into FSharp.Analyzers.Tests. (#62)
* Move data folder into FSharp.Analyzers.Tests. * Update path in tests. * Update scaffold pipeline.
- Loading branch information
Showing
208 changed files
with
87 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
tests/data | ||
tests/FSharp.Analyzers.Tests/data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 39 additions & 36 deletions
75
tests/FSharp.Analyzers.Tests/FSharp.Analyzers.Tests.fsproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,42 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<IsPackable>false</IsPackable> | ||
<GenerateProgramFile>false</GenerateProgramFile> | ||
<IsTestProject>true</IsTestProject> | ||
<AssemblyName>G-Research.FSharp.Analyzers.Tests</AssemblyName> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="Common.fs" /> | ||
<Compile Include="StringAnalyzerTests.fs" /> | ||
<Compile Include="PartialAppAnalyzerTests.fs" /> | ||
<Compile Include="JsonSerializerOptionsAnalyzerTests.fs" /> | ||
<Compile Include="UnionCaseAnalyzerTests.fs" /> | ||
<Compile Include="VirtualCallAnalyzerTests.fs" /> | ||
<Compile Include="LoggingArgFuncNotFullyAppliedAnalyzerTests.fs" /> | ||
<Compile Include="LoggingTemplateMissingValuesAnalyzerTests.fs" /> | ||
<Compile Include="TypeAnnotateStringFunctionAnalyzerTests.fs" /> | ||
<Compile Include="ImmutableCollectionEqualityAnalyzerTests.fs" /> | ||
<Compile Include="TypedInterpolatedStringsAnalyzerTests.fs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<PackageReference Update="FSharp.Core" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" /> | ||
<PackageReference Include="NUnit" /> | ||
<PackageReference Include="NUnit3TestAdapter" /> | ||
<PackageReference Include="coverlet.collector" /> | ||
</ItemGroup> | ||
<ItemGroup Condition="'$(UseLocalAnalyzersSDK)' == 'false'"> | ||
<PackageReference Include="FSharp.Analyzers.SDK.Testing" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\..\src\FSharp.Analyzers\FSharp.Analyzers.fsproj" /> | ||
</ItemGroup> | ||
<ItemGroup Condition="'$(UseLocalAnalyzersSDK)' == 'true'"> | ||
<ProjectReference Include="$(LocalAnalyzersSDKRepo)/src/FSharp.Analyzers.SDK.Testing/FSharp.Analyzers.SDK.Testing.fsproj" /> | ||
</ItemGroup> | ||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<IsPackable>false</IsPackable> | ||
<GenerateProgramFile>false</GenerateProgramFile> | ||
<IsTestProject>true</IsTestProject> | ||
<AssemblyName>G-Research.FSharp.Analyzers.Tests</AssemblyName> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="Common.fs"/> | ||
<Compile Include="StringAnalyzerTests.fs"/> | ||
<Compile Include="PartialAppAnalyzerTests.fs"/> | ||
<Compile Include="JsonSerializerOptionsAnalyzerTests.fs"/> | ||
<Compile Include="UnionCaseAnalyzerTests.fs"/> | ||
<Compile Include="VirtualCallAnalyzerTests.fs"/> | ||
<Compile Include="LoggingArgFuncNotFullyAppliedAnalyzerTests.fs"/> | ||
<Compile Include="LoggingTemplateMissingValuesAnalyzerTests.fs"/> | ||
<Compile Include="TypeAnnotateStringFunctionAnalyzerTests.fs"/> | ||
<Compile Include="ImmutableCollectionEqualityAnalyzerTests.fs"/> | ||
<Compile Include="TypedInterpolatedStringsAnalyzerTests.fs"/> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="data\**\*.fs*" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<PackageReference Update="FSharp.Core"/> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk"/> | ||
<PackageReference Include="NUnit"/> | ||
<PackageReference Include="NUnit3TestAdapter"/> | ||
<PackageReference Include="coverlet.collector"/> | ||
</ItemGroup> | ||
<ItemGroup Condition="'$(UseLocalAnalyzersSDK)' == 'false'"> | ||
<PackageReference Include="FSharp.Analyzers.SDK.Testing"/> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\..\src\FSharp.Analyzers\FSharp.Analyzers.fsproj"/> | ||
</ItemGroup> | ||
<ItemGroup Condition="'$(UseLocalAnalyzersSDK)' == 'true'"> | ||
<ProjectReference Include="$(LocalAnalyzersSDKRepo)/src/FSharp.Analyzers.SDK.Testing/FSharp.Analyzers.SDK.Testing.fsproj"/> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,57 @@ | ||
namespace GR.FSharp.Analyzers.Tests | ||
module GR.FSharp.Analyzers.Tests.PartialAppAnalyzerTests | ||
|
||
module PartialAppAnalyzerTests = | ||
open System.Collections | ||
open System.IO | ||
open NUnit.Framework | ||
open FSharp.Compiler.CodeAnalysis | ||
open FSharp.Analyzers.SDK.Testing | ||
open GR.FSharp.Analyzers | ||
open GR.FSharp.Analyzers.Tests.Common | ||
|
||
open System.Collections | ||
open System.IO | ||
open NUnit.Framework | ||
open FSharp.Compiler.CodeAnalysis | ||
open FSharp.Analyzers.SDK.Testing | ||
open GR.FSharp.Analyzers | ||
open GR.FSharp.Analyzers.Tests.Common | ||
let mutable projectOptions : FSharpProjectOptions = FSharpProjectOptions.zero | ||
|
||
let mutable projectOptions : FSharpProjectOptions = FSharpProjectOptions.zero | ||
[<SetUp>] | ||
let Setup () = | ||
task { | ||
let! options = mkOptionsFromProject "net7.0" [] | ||
|
||
[<SetUp>] | ||
let Setup () = | ||
task { | ||
let! options = mkOptionsFromProject "net7.0" [] | ||
projectOptions <- options | ||
} | ||
|
||
projectOptions <- options | ||
} | ||
type TestCases() = | ||
|
||
type TestCases() = | ||
static member DataFolder = Path.Combine (__SOURCE_DIRECTORY__, "..", "data") | ||
interface IEnumerable with | ||
member _.GetEnumerator () : IEnumerator = | ||
constructTestCaseEnumerator [| "partialapp" |] | ||
|
||
interface IEnumerable with | ||
member _.GetEnumerator () : IEnumerator = | ||
let testsDirectory = Path.Combine (TestCases.DataFolder, "partialapp") | ||
[<TestCaseSource(typeof<TestCases>)>] | ||
let PartialAppTests (fileName : string) = | ||
task { | ||
let fileName = Path.Combine (dataFolder, fileName) | ||
|
||
Directory.EnumerateFiles (testsDirectory, "*.fs") | ||
|> Seq.map (fun f -> | ||
let fileName = Path.GetRelativePath (TestCases.DataFolder, f) | ||
[| fileName :> obj |] | ||
) | ||
|> fun s -> s.GetEnumerator () | ||
let! messages = | ||
File.ReadAllText fileName | ||
|> getContext projectOptions | ||
|> PartialAppAnalyzer.partialAppCliAnalyzer | ||
|
||
[<TestCaseSource(typeof<TestCases>)>] | ||
let PartialAppTests (fileName : string) = | ||
task { | ||
let dataFolder = TestCases.DataFolder | ||
let fileName = Path.Combine (dataFolder, fileName) | ||
do! assertExpected fileName messages | ||
} | ||
|
||
let! messages = | ||
File.ReadAllText fileName | ||
|> getContext projectOptions | ||
|> PartialAppAnalyzer.partialAppCliAnalyzer | ||
type NegativeTestCases() = | ||
|
||
do! assertExpected fileName messages | ||
} | ||
interface IEnumerable with | ||
member _.GetEnumerator () : IEnumerator = | ||
constructTestCaseEnumerator [| "partialapp" ; "negative" |] | ||
|
||
type NegativeTestCases() = | ||
[<TestCaseSource(typeof<NegativeTestCases>)>] | ||
let NegativeTests (fileName : string) = | ||
task { | ||
let fileName = Path.Combine (dataFolder, fileName) | ||
|
||
interface IEnumerable with | ||
member _.GetEnumerator () : IEnumerator = | ||
constructTestCaseEnumerator [| "partialapp" ; "negative" |] | ||
let! messages = | ||
File.ReadAllText fileName | ||
|> getContext projectOptions | ||
|> PartialAppAnalyzer.partialAppCliAnalyzer | ||
|
||
[<TestCaseSource(typeof<NegativeTestCases>)>] | ||
let NegativeTests (fileName : string) = | ||
task { | ||
let fileName = Path.Combine (dataFolder, fileName) | ||
|
||
let! messages = | ||
File.ReadAllText fileName | ||
|> getContext projectOptions | ||
|> PartialAppAnalyzer.partialAppCliAnalyzer | ||
|
||
Assert.That (messages, Is.Empty) | ||
} | ||
Assert.That (messages, Is.Empty) | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.