Skip to content

Commit

Permalink
Generalise the test framework (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
Smaug123 authored Feb 15, 2024
1 parent 10808cb commit 367eb98
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 10 deletions.
3 changes: 3 additions & 0 deletions tests/FSharp.Analyzers.Tests/Common.fs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ open System.Threading.Tasks
open NUnit.Framework
open FSharp.Analyzers.SDK

[<Literal>]
let framework = "net7.0"

let shouldUpdateBaseline () =
Environment.GetEnvironmentVariable "TEST_UPDATE_BSL"
|> Option.ofObj
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ let mutable projectOptions : FSharpProjectOptions = FSharpProjectOptions.zero
[<SetUp>]
let Setup () =
task {
let! options = mkOptionsFromProject "net7.0" []
let! options = mkOptionsFromProject framework []
projectOptions <- options
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ let mutable projectOptions : FSharpProjectOptions = FSharpProjectOptions.zero
[<SetUp>]
let Setup () =
task {
let! options = mkOptionsFromProject "net7.0" []
let! options = mkOptionsFromProject framework []
projectOptions <- options
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module JsonSerializerOptionsAnalyzerTests =
task {
let! options =
mkOptionsFromProject
"net7.0"
framework
[
{
Name = "System.Text.Json"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module LoggingArgFuncNotFullyAppliedAnalyzerTests =
task {
let! options =
mkOptionsFromProject
"net7.0"
framework
[
{
Name = "Microsoft.Extensions.Logging"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module LoggingTemplateMissingValuesAnalyzerTests =
task {
let! options =
mkOptionsFromProject
"net7.0"
framework
[
{
Name = "Microsoft.Extensions.Logging"
Expand Down
2 changes: 1 addition & 1 deletion tests/FSharp.Analyzers.Tests/StringAnalyzerTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ let mutable projectOptions : FSharpProjectOptions = FSharpProjectOptions.zero
[<SetUp>]
let Setup () =
task {
let! options = mkOptionsFromProject "net7.0" []
let! options = mkOptionsFromProject framework []
projectOptions <- options
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ let mutable projectOptions : FSharpProjectOptions = FSharpProjectOptions.zero
[<SetUp>]
let Setup () =
task {
let! options = mkOptionsFromProject "net7.0" []
let! options = mkOptionsFromProject framework []

projectOptions <- options
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ let mutable projectOptions : FSharpProjectOptions = FSharpProjectOptions.zero
[<SetUp>]
let Setup () =
task {
let! options = mkOptionsFromProject "net7.0" []
let! options = mkOptionsFromProject framework []
projectOptions <- options
}

Expand Down
2 changes: 1 addition & 1 deletion tests/FSharp.Analyzers.Tests/UnionCaseAnalyzerTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module UnionCaseAnalyzerTests =
[<SetUp>]
let Setup () =
task {
let! options = mkOptionsFromProject "net7.0" []
let! options = mkOptionsFromProject framework []

projectOptions <- options
}
Expand Down
2 changes: 1 addition & 1 deletion tests/FSharp.Analyzers.Tests/VirtualCallAnalyzerTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module VirtualCallAnalyzerTests =
[<SetUp>]
let Setup () =
task {
let! options = mkOptionsFromProject "net7.0" []
let! options = mkOptionsFromProject framework []

projectOptions <- options
}
Expand Down

0 comments on commit 367eb98

Please sign in to comment.