From 75cbd31a2eb97afecbb03db4a5336f0aed8b2cce Mon Sep 17 00:00:00 2001 From: Petr Date: Tue, 29 Oct 2024 16:45:01 +0100 Subject: [PATCH] Consolidate test helpers a bit --- .../FSharp.Compiler.ComponentTests.fsproj | 3 -- .../Signatures/HashConstraintTests.fs | 1 - .../Signatures/MemberTests.fs | 1 - .../Signatures/ModuleOrNamespaceTests.fs | 1 - .../Signatures/NestedTypeTests.fs | 1 - .../Signatures/RecordTests.fs | 1 - .../Signatures/TypeTests.fs | 1 - .../AssemblyReaderShim.fs | 1 - .../CSharpProjectAnalysis.fs | 2 +- tests/FSharp.Compiler.Service.Tests/Common.fs | 2 +- .../EditorTests.fs | 2 +- .../ExprTests.fs | 2 +- .../FSharp.Compiler.Service.Tests.fsproj | 3 -- .../FileSystemTests.fs | 2 +- .../InteractiveCheckerTests.fs | 2 +- .../ModuleReaderCancellationTests.fs | 2 +- .../MultiProjectAnalysisTests.fs | 2 +- .../ParserTests.fs | 2 +- .../PatternMatchCompilationTests.fs | 2 +- .../PerfTests.fs | 2 +- .../ProjectAnalysisTests.fs | 4 +-- .../RangeTests.fs | 2 +- .../ServiceUntypedParseTests.fs | 2 +- .../FSharp.Compiler.Service.Tests/Symbols.fs | 2 +- .../XmlDocTests.fs | 2 +- tests/FSharp.Test.Utilities/Assert.fs | 11 ++++++- .../BasicGrammarElements/CharConstants.fs | 1 + .../BasicGrammarElements/DecimalConstants.fs | 1 + .../BasicGrammarElements/IntegerConstants.fs | 1 + .../Core/Collections/IEnumerableTests.fs | 1 + .../Libraries/Core/Operators/RoundTests.fs | 1 + .../Libraries/Core/Operators/StringTests.fs | 1 + .../Libraries/Core/Reflection/SprintfTests.fs | 1 + .../Core/Unchecked/DefaultOfTests.fs | 1 + tests/fsharp/XunitHelpers.fs | 7 ---- tests/fsharp/tests.fs | 32 +++++++++---------- tests/service/FsUnit.fs | 6 ---- 37 files changed, 51 insertions(+), 60 deletions(-) delete mode 100644 tests/service/FsUnit.fs diff --git a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj index 82c6d363b47..02b1c629b91 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj +++ b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj @@ -28,9 +28,6 @@ - - FsUnit.fs - diff --git a/tests/FSharp.Compiler.ComponentTests/Signatures/HashConstraintTests.fs b/tests/FSharp.Compiler.ComponentTests/Signatures/HashConstraintTests.fs index ac624ec19a7..c0911187a86 100644 --- a/tests/FSharp.Compiler.ComponentTests/Signatures/HashConstraintTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Signatures/HashConstraintTests.fs @@ -1,7 +1,6 @@ module Signatures.HashConstraintTests open Xunit -open FsUnit open FSharp.Test.Compiler open Signatures.TestHelpers diff --git a/tests/FSharp.Compiler.ComponentTests/Signatures/MemberTests.fs b/tests/FSharp.Compiler.ComponentTests/Signatures/MemberTests.fs index 3475535249a..aa0deb220d1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Signatures/MemberTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Signatures/MemberTests.fs @@ -1,7 +1,6 @@ module Signatures.MemberTests open Xunit -open FsUnit open FSharp.Test.Compiler open Signatures.TestHelpers diff --git a/tests/FSharp.Compiler.ComponentTests/Signatures/ModuleOrNamespaceTests.fs b/tests/FSharp.Compiler.ComponentTests/Signatures/ModuleOrNamespaceTests.fs index 413e4a7fdf9..062b8ba9166 100644 --- a/tests/FSharp.Compiler.ComponentTests/Signatures/ModuleOrNamespaceTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Signatures/ModuleOrNamespaceTests.fs @@ -1,7 +1,6 @@ module Signatures.ModuleOrNamespaceTests open Xunit -open FsUnit open FSharp.Test.Compiler open Signatures.TestHelpers diff --git a/tests/FSharp.Compiler.ComponentTests/Signatures/NestedTypeTests.fs b/tests/FSharp.Compiler.ComponentTests/Signatures/NestedTypeTests.fs index 4dfce060679..97df2389c78 100644 --- a/tests/FSharp.Compiler.ComponentTests/Signatures/NestedTypeTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Signatures/NestedTypeTests.fs @@ -1,7 +1,6 @@ module Signatures.NestedTypeTests open Xunit -open FsUnit open FSharp.Test open FSharp.Test.Compiler open Signatures.TestHelpers diff --git a/tests/FSharp.Compiler.ComponentTests/Signatures/RecordTests.fs b/tests/FSharp.Compiler.ComponentTests/Signatures/RecordTests.fs index cb5ec18da97..ae3bbcd57f6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Signatures/RecordTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Signatures/RecordTests.fs @@ -1,7 +1,6 @@ module Signatures.RecordTests open Xunit -open FsUnit open FSharp.Test.Compiler open Signatures.TestHelpers diff --git a/tests/FSharp.Compiler.ComponentTests/Signatures/TypeTests.fs b/tests/FSharp.Compiler.ComponentTests/Signatures/TypeTests.fs index d066d74dd9a..f6b31e62d24 100644 --- a/tests/FSharp.Compiler.ComponentTests/Signatures/TypeTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Signatures/TypeTests.fs @@ -2,7 +2,6 @@ open FSharp.Compiler.Symbols open Xunit -open FsUnit open FSharp.Test.Compiler open Signatures.TestHelpers diff --git a/tests/FSharp.Compiler.Service.Tests/AssemblyReaderShim.fs b/tests/FSharp.Compiler.Service.Tests/AssemblyReaderShim.fs index ebe2c3dd61d..9e19b32834f 100644 --- a/tests/FSharp.Compiler.Service.Tests/AssemblyReaderShim.fs +++ b/tests/FSharp.Compiler.Service.Tests/AssemblyReaderShim.fs @@ -1,6 +1,5 @@ module FSharp.Compiler.Service.Tests.AssemblyReaderShim -open FsUnit open FSharp.Compiler.Text open FSharp.Compiler.AbstractIL.ILBinaryReader open Xunit diff --git a/tests/FSharp.Compiler.Service.Tests/CSharpProjectAnalysis.fs b/tests/FSharp.Compiler.Service.Tests/CSharpProjectAnalysis.fs index aa4cc9af679..bcbe03f4fa5 100644 --- a/tests/FSharp.Compiler.Service.Tests/CSharpProjectAnalysis.fs +++ b/tests/FSharp.Compiler.Service.Tests/CSharpProjectAnalysis.fs @@ -1,7 +1,7 @@ module FSharp.Compiler.Service.Tests.CSharpProjectAnalysis open Xunit -open FsUnit +open FSharp.Test.Assert open System.IO open FSharp.Compiler.Diagnostics open FSharp.Compiler.IO diff --git a/tests/FSharp.Compiler.Service.Tests/Common.fs b/tests/FSharp.Compiler.Service.Tests/Common.fs index df51f666ccd..25e441952b6 100644 --- a/tests/FSharp.Compiler.Service.Tests/Common.fs +++ b/tests/FSharp.Compiler.Service.Tests/Common.fs @@ -13,7 +13,7 @@ open FSharp.Compiler.Symbols open FSharp.Compiler.Syntax open FSharp.Compiler.Text open TestFramework -open FsUnit +open FSharp.Test.Assert open Xunit open FSharp.Test.Utilities diff --git a/tests/FSharp.Compiler.Service.Tests/EditorTests.fs b/tests/FSharp.Compiler.Service.Tests/EditorTests.fs index 79e7f244343..bc6ad3d3e88 100644 --- a/tests/FSharp.Compiler.Service.Tests/EditorTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/EditorTests.fs @@ -1,7 +1,7 @@ module FSharp.Compiler.Service.Tests.EditorTests open Xunit -open FsUnit +open FSharp.Test.Assert open FSharp.Compiler.CodeAnalysis open FSharp.Compiler.EditorServices open FSharp.Compiler.Service.Tests.Common diff --git a/tests/FSharp.Compiler.Service.Tests/ExprTests.fs b/tests/FSharp.Compiler.Service.Tests/ExprTests.fs index c8870dd700e..4d74b131ed5 100644 --- a/tests/FSharp.Compiler.Service.Tests/ExprTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/ExprTests.fs @@ -1,7 +1,7 @@ module FSharp.Compiler.Service.Tests.ExprTests open Xunit -open FsUnit +open FSharp.Test.Assert open System open System.Text open System.Collections.Generic diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj index 9f0c7f230b9..910e9543ada 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj @@ -21,9 +21,6 @@ - - FsUnit.fs - diff --git a/tests/FSharp.Compiler.Service.Tests/FileSystemTests.fs b/tests/FSharp.Compiler.Service.Tests/FileSystemTests.fs index 77a1d657308..ff62594067d 100644 --- a/tests/FSharp.Compiler.Service.Tests/FileSystemTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/FileSystemTests.fs @@ -1,7 +1,7 @@ module FSharp.Compiler.Service.Tests.FileSystemTests open Xunit -open FsUnit +open FSharp.Test.Assert open FSharp.Test open System open System.IO diff --git a/tests/FSharp.Compiler.Service.Tests/InteractiveCheckerTests.fs b/tests/FSharp.Compiler.Service.Tests/InteractiveCheckerTests.fs index 39e113310c5..39e38dfd1a1 100644 --- a/tests/FSharp.Compiler.Service.Tests/InteractiveCheckerTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/InteractiveCheckerTests.fs @@ -1,7 +1,7 @@ module FSharp.Compiler.Service.Tests.InteractiveCheckerTests open Xunit -open FsUnit +open FSharp.Test.Assert open System open FSharp.Compiler.Service.Tests.Common open FSharp.Compiler.Syntax diff --git a/tests/FSharp.Compiler.Service.Tests/ModuleReaderCancellationTests.fs b/tests/FSharp.Compiler.Service.Tests/ModuleReaderCancellationTests.fs index ed245117916..c760a5f070c 100644 --- a/tests/FSharp.Compiler.Service.Tests/ModuleReaderCancellationTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/ModuleReaderCancellationTests.fs @@ -9,7 +9,7 @@ open FSharp.Compiler.AbstractIL.IL open FSharp.Compiler.AbstractIL.ILBinaryReader open FSharp.Compiler.CodeAnalysis open FSharp.Compiler.Text -open FsUnit +open FSharp.Test.Assert open Internal.Utilities.Library open FSharp.Compiler.Service.Tests.Common open Xunit diff --git a/tests/FSharp.Compiler.Service.Tests/MultiProjectAnalysisTests.fs b/tests/FSharp.Compiler.Service.Tests/MultiProjectAnalysisTests.fs index 3564288b229..230d90f2527 100644 --- a/tests/FSharp.Compiler.Service.Tests/MultiProjectAnalysisTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/MultiProjectAnalysisTests.fs @@ -1,7 +1,7 @@ module FSharp.Compiler.Service.Tests.MultiProjectAnalysisTests open Xunit -open FsUnit +open FSharp.Test.Assert open System.IO open System.Collections.Generic open FSharp.Compiler.CodeAnalysis diff --git a/tests/FSharp.Compiler.Service.Tests/ParserTests.fs b/tests/FSharp.Compiler.Service.Tests/ParserTests.fs index 149a74d25b2..2fc76220cd8 100644 --- a/tests/FSharp.Compiler.Service.Tests/ParserTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/ParserTests.fs @@ -3,7 +3,7 @@ open FSharp.Compiler.Service.Tests.Common open FSharp.Compiler.Syntax open FSharp.Compiler.Text -open FsUnit +open FSharp.Test.Assert open Xunit [] diff --git a/tests/FSharp.Compiler.Service.Tests/PatternMatchCompilationTests.fs b/tests/FSharp.Compiler.Service.Tests/PatternMatchCompilationTests.fs index e22c58e8a3a..5bd733d5316 100644 --- a/tests/FSharp.Compiler.Service.Tests/PatternMatchCompilationTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/PatternMatchCompilationTests.fs @@ -3,7 +3,7 @@ module FSharp.Compiler.Service.Tests.PatternMatchCompilationTests // Most tests here weren't running on desktop and fails open FSharp.Compiler.Service.Tests.Common -open FsUnit +open FSharp.Test.Assert open Xunit open FSharp.Test diff --git a/tests/FSharp.Compiler.Service.Tests/PerfTests.fs b/tests/FSharp.Compiler.Service.Tests/PerfTests.fs index 0a58bd4ec72..aa270182895 100644 --- a/tests/FSharp.Compiler.Service.Tests/PerfTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/PerfTests.fs @@ -1,7 +1,7 @@ module FSharp.Compiler.Service.Tests.PerfTests open Xunit -open FsUnit +open FSharp.Test.Assert open System.IO open FSharp.Compiler.CodeAnalysis open FSharp.Compiler.IO diff --git a/tests/FSharp.Compiler.Service.Tests/ProjectAnalysisTests.fs b/tests/FSharp.Compiler.Service.Tests/ProjectAnalysisTests.fs index 5752f9de41c..156a9d678f3 100644 --- a/tests/FSharp.Compiler.Service.Tests/ProjectAnalysisTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/ProjectAnalysisTests.fs @@ -5,7 +5,7 @@ let runningOnMono = try System.Type.GetType("Mono.Runtime") <> null with e -> false open Xunit -open FsUnit +open FSharp.Test.Assert open FSharp.Test open System open System.IO @@ -96,7 +96,7 @@ let mmmm2 : M.CAbbrev = new M.CAbbrev() // note, these don't count as uses of C let ``Test project1 whole project errors`` () = let wholeProjectResults = checker.ParseAndCheckProject(Project1.options) |> Async.RunImmediate - wholeProjectResults .Diagnostics.Length |> shouldEqual 2 + wholeProjectResults.Diagnostics.Length |> shouldEqual 2 wholeProjectResults.Diagnostics[1].Message.Contains("Incomplete pattern matches on this expression") |> shouldEqual true // yes it does wholeProjectResults.Diagnostics[1].ErrorNumber |> shouldEqual 25 diff --git a/tests/FSharp.Compiler.Service.Tests/RangeTests.fs b/tests/FSharp.Compiler.Service.Tests/RangeTests.fs index d177d92165c..9bf0564e437 100644 --- a/tests/FSharp.Compiler.Service.Tests/RangeTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/RangeTests.fs @@ -3,7 +3,7 @@ open FSharp.Compiler.Text open FSharp.Compiler.Text.Position open FSharp.Compiler.Text.Range -open FsUnit +open FSharp.Test.Assert open Xunit [] diff --git a/tests/FSharp.Compiler.Service.Tests/ServiceUntypedParseTests.fs b/tests/FSharp.Compiler.Service.Tests/ServiceUntypedParseTests.fs index 330bcae5c5c..51be9f0c058 100644 --- a/tests/FSharp.Compiler.Service.Tests/ServiceUntypedParseTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/ServiceUntypedParseTests.fs @@ -1,7 +1,7 @@ module FSharp.Compiler.Service.Tests.ServiceUntypedParseTests open System.IO -open FsUnit +open FSharp.Test.Assert open FSharp.Compiler.EditorServices open FSharp.Compiler.Service.Tests.Common open FSharp.Compiler.Syntax diff --git a/tests/FSharp.Compiler.Service.Tests/Symbols.fs b/tests/FSharp.Compiler.Service.Tests/Symbols.fs index e0082fcde30..eba673f5963 100644 --- a/tests/FSharp.Compiler.Service.Tests/Symbols.fs +++ b/tests/FSharp.Compiler.Service.Tests/Symbols.fs @@ -5,7 +5,7 @@ open FSharp.Compiler.Service.Tests.Common open FSharp.Compiler.Symbols open FSharp.Compiler.Syntax open FSharp.Compiler.SyntaxTrivia -open FsUnit +open FSharp.Test.Assert open Xunit module ActivePatterns = diff --git a/tests/FSharp.Compiler.Service.Tests/XmlDocTests.fs b/tests/FSharp.Compiler.Service.Tests/XmlDocTests.fs index 90290dd99f6..3e427293e25 100644 --- a/tests/FSharp.Compiler.Service.Tests/XmlDocTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/XmlDocTests.fs @@ -5,7 +5,7 @@ open FSharp.Compiler.Service.Tests.Common open FSharp.Compiler.Symbols open FSharp.Compiler.Syntax open FSharp.Test.Compiler -open FsUnit +open FSharp.Test.Assert open Xunit let (|Types|TypeSigs|) = function diff --git a/tests/FSharp.Test.Utilities/Assert.fs b/tests/FSharp.Test.Utilities/Assert.fs index fc36129666f..41287757a0f 100644 --- a/tests/FSharp.Test.Utilities/Assert.fs +++ b/tests/FSharp.Test.Utilities/Assert.fs @@ -3,7 +3,7 @@ namespace FSharp.Test module Assert = open FluentAssertions open System.Collections - open System.Text + open Xunit open System.IO let inline shouldBeEqualWith (expected : ^T) (message: string) (actual: ^U) = @@ -18,9 +18,18 @@ module Assert = let inline shouldContain (needle : string) (haystack : string) = haystack.Should().Contain(needle) |> ignore + // One fine day, all of the 3 things below should be purged and replaced with pure Assert.Equal. + // Xunit checks types by default. These are just artifacts of the testing chaos in the repo back in a day. let inline shouldBe (expected : ^T) (actual : ^U) = actual.Should().Be(expected, "") |> ignore + let inline areEqual (expected: ^T) (actual: ^T) = + Assert.Equal<^T>(expected, actual) + + let inline shouldEqual (x: 'a) (y: 'a) = + Assert.Equal<'a>(x, y) + // + let inline shouldBeEmpty (actual : ^T when ^T :> IEnumerable) = actual.Should().BeEmpty("") |> ignore diff --git a/tests/fsharp/Compiler/Conformance/BasicGrammarElements/CharConstants.fs b/tests/fsharp/Compiler/Conformance/BasicGrammarElements/CharConstants.fs index 7f91ed7653b..1730976ad20 100644 --- a/tests/fsharp/Compiler/Conformance/BasicGrammarElements/CharConstants.fs +++ b/tests/fsharp/Compiler/Conformance/BasicGrammarElements/CharConstants.fs @@ -3,6 +3,7 @@ namespace FSharp.Compiler.UnitTests open Xunit +open FSharp.Test module ``Char Constants`` = diff --git a/tests/fsharp/Compiler/Conformance/BasicGrammarElements/DecimalConstants.fs b/tests/fsharp/Compiler/Conformance/BasicGrammarElements/DecimalConstants.fs index e40e1024006..0333711b8ac 100644 --- a/tests/fsharp/Compiler/Conformance/BasicGrammarElements/DecimalConstants.fs +++ b/tests/fsharp/Compiler/Conformance/BasicGrammarElements/DecimalConstants.fs @@ -3,6 +3,7 @@ namespace FSharp.Compiler.UnitTests open Xunit +open FSharp.Test module ``Decimal Constants`` = diff --git a/tests/fsharp/Compiler/Conformance/BasicGrammarElements/IntegerConstants.fs b/tests/fsharp/Compiler/Conformance/BasicGrammarElements/IntegerConstants.fs index a91c92ae6e9..46fb01dca01 100644 --- a/tests/fsharp/Compiler/Conformance/BasicGrammarElements/IntegerConstants.fs +++ b/tests/fsharp/Compiler/Conformance/BasicGrammarElements/IntegerConstants.fs @@ -3,6 +3,7 @@ namespace FSharp.Compiler.UnitTests open Xunit +open FSharp.Test module ``Integer Constants`` = diff --git a/tests/fsharp/Compiler/Libraries/Core/Collections/IEnumerableTests.fs b/tests/fsharp/Compiler/Libraries/Core/Collections/IEnumerableTests.fs index e7bca1b380e..46e10f6605e 100644 --- a/tests/fsharp/Compiler/Libraries/Core/Collections/IEnumerableTests.fs +++ b/tests/fsharp/Compiler/Libraries/Core/Collections/IEnumerableTests.fs @@ -3,6 +3,7 @@ namespace FSharp.Compiler.UnitTests open Xunit +open FSharp.Test module ``IEnumerable Tests`` = diff --git a/tests/fsharp/Compiler/Libraries/Core/Operators/RoundTests.fs b/tests/fsharp/Compiler/Libraries/Core/Operators/RoundTests.fs index 523c5aeb47b..3153a82d9e9 100644 --- a/tests/fsharp/Compiler/Libraries/Core/Operators/RoundTests.fs +++ b/tests/fsharp/Compiler/Libraries/Core/Operators/RoundTests.fs @@ -3,6 +3,7 @@ namespace FSharp.Compiler.UnitTests open Xunit +open FSharp.Test module ``Round Tests`` = diff --git a/tests/fsharp/Compiler/Libraries/Core/Operators/StringTests.fs b/tests/fsharp/Compiler/Libraries/Core/Operators/StringTests.fs index 0a4de5d8219..3317542d33f 100644 --- a/tests/fsharp/Compiler/Libraries/Core/Operators/StringTests.fs +++ b/tests/fsharp/Compiler/Libraries/Core/Operators/StringTests.fs @@ -4,6 +4,7 @@ namespace FSharp.Compiler.UnitTests open Xunit open System +open FSharp.Test module ``String Tests`` = diff --git a/tests/fsharp/Compiler/Libraries/Core/Reflection/SprintfTests.fs b/tests/fsharp/Compiler/Libraries/Core/Reflection/SprintfTests.fs index aa4aa6aac8a..e16e8372263 100644 --- a/tests/fsharp/Compiler/Libraries/Core/Reflection/SprintfTests.fs +++ b/tests/fsharp/Compiler/Libraries/Core/Reflection/SprintfTests.fs @@ -3,6 +3,7 @@ namespace FSharp.Compiler.UnitTests open Xunit +open FSharp.Test module ``Sprintf Tests`` = diff --git a/tests/fsharp/Compiler/Libraries/Core/Unchecked/DefaultOfTests.fs b/tests/fsharp/Compiler/Libraries/Core/Unchecked/DefaultOfTests.fs index e34c074ef13..781807492c7 100644 --- a/tests/fsharp/Compiler/Libraries/Core/Unchecked/DefaultOfTests.fs +++ b/tests/fsharp/Compiler/Libraries/Core/Unchecked/DefaultOfTests.fs @@ -3,6 +3,7 @@ namespace FSharp.Compiler.UnitTests open Xunit +open FSharp.Test module ``DefaultOf Tests`` = diff --git a/tests/fsharp/XunitHelpers.fs b/tests/fsharp/XunitHelpers.fs index c7e7493c046..6bfb5031f13 100644 --- a/tests/fsharp/XunitHelpers.fs +++ b/tests/fsharp/XunitHelpers.fs @@ -6,10 +6,3 @@ module Assert = [] do() - - let inline fail message = Assert.Fail message - - let inline failf fmt = Printf.kprintf fail fmt - - let inline areEqual (expected: ^T) (actual: ^T) = - Assert.Equal<^T>(expected, actual) diff --git a/tests/fsharp/tests.fs b/tests/fsharp/tests.fs index ed99adda96a..8b13fc003a3 100644 --- a/tests/fsharp/tests.fs +++ b/tests/fsharp/tests.fs @@ -404,7 +404,7 @@ module CoreTests = let diffs = fsdiff cfg outFile expectedFile match diffs with | "" -> () - | _ -> Assert.failf "'%s' and '%s' differ; %A" outFile expectedFile diffs + | _ -> failwithf "'%s' and '%s' differ; %A" outFile expectedFile diffs [] let fsfromcs () = @@ -468,7 +468,7 @@ module CoreTests = let diffs = fsdiff cfg outFile expectedFile match diffs with | "" -> () - | _ -> Assert.failf "'%s' and '%s' differ; %A" outFile expectedFile diffs + | _ -> failwithf "'%s' and '%s' differ; %A" outFile expectedFile diffs // check error messages for some cases let outFile = "compilation.errors.output.txt" @@ -478,7 +478,7 @@ module CoreTests = let diffs = fsdiff cfg outFile expectedFile match diffs with | "" -> () - | _ -> Assert.failf "'%s' and '%s' differ; %A" outFile expectedFile diffs + | _ -> failwithf "'%s' and '%s' differ; %A" outFile expectedFile diffs [] let ``fsi-reference`` () = @@ -619,11 +619,11 @@ module CoreTests = match fsdiff cfg diffFileOut expectedFileOut with | "" -> () - | diffs -> Assert.failf "'%s' and '%s' differ; %A" diffFileOut expectedFileOut diffs + | diffs -> failwithf "'%s' and '%s' differ; %A" diffFileOut expectedFileOut diffs match fsdiff cfg diffFileErr expectedFileErr with | "" -> () - | diffs -> Assert.failf "'%s' and '%s' differ; %A" diffFileErr expectedFileErr diffs + | diffs -> failwithf "'%s' and '%s' differ; %A" diffFileErr expectedFileErr diffs [] let ``printing`` () = @@ -1031,13 +1031,13 @@ module CoreTests = match diffs with | "" -> () - | _ -> Assert.failf "'%s' and '%s' differ; %A" stdoutPath stdoutBaseline diffs + | _ -> failwithf "'%s' and '%s' differ; %A" stdoutPath stdoutBaseline diffs let diffs2 = fsdiff cfg stderrPath stderrBaseline match diffs2 with | "" -> () - | _ -> Assert.failf "'%s' and '%s' differ; %A" stderrPath stderrBaseline diffs2 + | _ -> failwithf "'%s' and '%s' differ; %A" stderrPath stderrBaseline diffs2 [] let ``load-script`` () = @@ -1160,13 +1160,13 @@ module CoreTests = match diffs with | "" -> () - | _ -> Assert.failf "'%s' and '%s' differ; %A" stdoutPath stdoutBaseline diffs + | _ -> failwithf "'%s' and '%s' differ; %A" stdoutPath stdoutBaseline diffs let diffs2 = fsdiff cfg stderrPath stderrBaseline match diffs2 with | "" -> () - | _ -> Assert.failf "'%s' and '%s' differ; %A" stderrPath stderrBaseline diffs2 + | _ -> failwithf "'%s' and '%s' differ; %A" stderrPath stderrBaseline diffs2 #endif @@ -1739,7 +1739,7 @@ module RegressionTests = match diff with | "" -> () | _ -> - Assert.failf "'%s' and '%s' differ; %A" (getfullpath cfg outFile) (getfullpath cfg expectedFile) diff + failwithf "'%s' and '%s' differ; %A" (getfullpath cfg outFile) (getfullpath cfg expectedFile) diff let outFile2 = "output.test.txt" let expectedFile2 = "output.test.bsl" @@ -1750,7 +1750,7 @@ module RegressionTests = match diff2 with | "" -> () | _ -> - Assert.failf "'%s' and '%s' differ; %A" (getfullpath cfg outFile2) (getfullpath cfg expectedFile2) diff2 + failwithf "'%s' and '%s' differ; %A" (getfullpath cfg outFile2) (getfullpath cfg expectedFile2) diff2 #endif [] @@ -1838,7 +1838,7 @@ module OptimizationTests = match diff with | "" -> () | _ -> - Assert.failf "'%s' and '%s' differ; %A" (getfullpath cfg outFile) (getfullpath cfg expectedFile) diff + failwithf "'%s' and '%s' differ; %A" (getfullpath cfg outFile) (getfullpath cfg expectedFile) diff [] @@ -1855,7 +1855,7 @@ module OptimizationTests = match diff with | "" -> () - | _ -> Assert.failf "'%s' and '%s' differ; %A" (getfullpath cfg outFile) (getfullpath cfg expectedFile) diff + | _ -> failwithf "'%s' and '%s' differ; %A" (getfullpath cfg outFile) (getfullpath cfg expectedFile) diff [] @@ -1872,7 +1872,7 @@ module OptimizationTests = match diff with | "" -> () - | _ -> Assert.failf "'%s' and '%s' differ; %A" (getfullpath cfg outFile) (getfullpath cfg expectedFile) diff + | _ -> failwithf "'%s' and '%s' differ; %A" (getfullpath cfg outFile) (getfullpath cfg expectedFile) diff [] @@ -1889,7 +1889,7 @@ module OptimizationTests = match diff with | "" -> () - | _ -> Assert.failf "'%s' and '%s' differ; %A" (getfullpath cfg outFile) (getfullpath cfg expectedFile) diff + | _ -> failwithf "'%s' and '%s' differ; %A" (getfullpath cfg outFile) (getfullpath cfg expectedFile) diff [] @@ -1922,7 +1922,7 @@ module OptimizationTests = match ``test--optimize.il`` with | [] -> () | lines -> - Assert.failf "Error: optimizations not removed. Relevant lines from IL file follow: %A" lines + failwithf "Error: optimizations not removed. Relevant lines from IL file follow: %A" lines let numElim = File.ReadLines (getfullpath cfg "test.il") diff --git a/tests/service/FsUnit.fs b/tests/service/FsUnit.fs deleted file mode 100644 index e17be411776..00000000000 --- a/tests/service/FsUnit.fs +++ /dev/null @@ -1,6 +0,0 @@ -module FsUnit - -open Xunit - -let shouldEqual (x: 'a) (y: 'a) = - Assert.Equal<'a>(x, y) \ No newline at end of file