Skip to content

Commit 3005b7d

Browse files
authored
Improve composability of verifyBaseline/verifyILBaseline (#18777)
1 parent 7dd51e6 commit 3005b7d

File tree

40 files changed

+276
-151
lines changed

40 files changed

+276
-151
lines changed

tests/FSharp.Compiler.ComponentTests/CompilerDirectives/Nowarn.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ module Nowarn =
113113
|| (List.zip expected actual |> List.exists(fun((error, line), d) -> error <> d.Error || line <> d.Range.StartLine))
114114

115115
let private withDiags testId langVersion flags (sources: SourceCodeFileKind list) (expected: (ErrorType * int) list) (result: CompilationResult) =
116-
let actual = result.Output.Diagnostics
116+
let actual = result.Output.Diagnostics |> List.distinctBy (fun ei -> ei.Range.StartLine, ei.Range.StartColumn, ei.Range.EndLine, ei.Range.EndColumn, ei.Message)
117117
if testFailed expected actual then
118118
let sb = new StringBuilder()
119119
let print (s: string) = sb.AppendLine s |> ignore

tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MethodResolution/MethodResolution.fs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ if returnvalue2<> true && value2 <> 7 then
3939
compilation
4040
|> getCompilation
4141
|> ignoreWarnings
42+
|> compile
4243
|> verifyILBaseline
4344

4445
[<Fact>]

tests/FSharp.Compiler.ComponentTests/Conformance/LexicalFiltering/OffsideExceptions/OffsideExceptions.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ module OffsideExceptions =
3838
|> getCompilation
3939
|> asFsx
4040
|> withLangVersion60
41+
|> typecheck
4142
|> verifyBaseline
42-
|> ignore
4343

4444
[<Fact>]
4545
let RelaxWhitespace2_Indentation() =

tests/FSharp.Compiler.ComponentTests/ConstraintSolver/PrimitiveConstraints.fs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ module PrimitiveConstraints =
1717
let ``Invalid object constructor`` compilation = // Regression test for FSharp1.0:4189
1818
compilation
1919
|> getCompilation
20+
|> typecheck
2021
|> verifyBaseline
2122

2223
[<Fact>]

tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionStepping.fs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ module AsyncExpressionStepping =
1414
|> withEmbeddedPdb
1515
|> withEmbedAllSource
1616
|> ignoreWarnings
17+
|> compile
1718
|> verifyBaseline
1819
|> verifyILBaseline
1920

tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/AttributeTargets.fs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ module AttributeTargets =
1414
|> withEmbeddedPdb
1515
|> withEmbedAllSource
1616
|> ignoreWarnings
17+
|> compile
1718
|> verifyBaseline
1819
|> verifyILBaseline
1920

tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember.fs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ module CCtorDUWithMember =
99
let verifyCompilation compilation =
1010
compilation
1111
|> withOptions [ "--test:EmitFeeFeeAs100001" ]
12+
|> withNoWarn 988
1213
|> asExe
1314
|> withNoOptimize
1415
|> withEmbeddedPdb
1516
|> withEmbedAllSource
1617
|> ignoreWarnings
18+
|> compile
1719
|> verifyBaseline
1820
|> verifyILBaseline
1921

@@ -71,7 +73,7 @@ type ILArrayShape =
7173
|> asLibrary
7274
|> withRealInternalSignature realSig
7375
|> compile
74-
|> withILContains [
76+
|> verifyILContains [
7577
"""
7678
.method public hidebysig instance bool
7779
Equals(class RealInternalSignature.ILArrayShape obj,
@@ -97,7 +99,7 @@ type ILArrayShape =
9799
|> asLibrary
98100
|> withRealInternalSignature realSig
99101
|> compile
100-
|> withILContains [
102+
|> verifyILContains [
101103
"""
102104
.method public hidebysig instance bool
103105
Equals(class RealInternalSignature.ILArrayShape obj,
@@ -125,7 +127,7 @@ Module.publicFunction () |> printfn "%b"
125127
|> asExe
126128
|> withRealInternalSignature realSig
127129
|> compileAndRun
128-
|> withILContains [
130+
|> verifyILContains [
129131
$$"""
130132
.method {{expected}} hidebysig instance bool Equals(class RealInternalSignature/Module/DU obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed
131133
{

tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute.fs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ module CompiledNameAttribute =
1010
compilation
1111
|> asFs
1212
|> withOptions [ "--test:EmitFeeFeeAs100001" ]
13+
|> withNoWarn 988
1314
|> asExe
1415
|> withNoOptimize
1516
|> withEmbeddedPdb
1617
|> withEmbedAllSource
1718
|> ignoreWarnings
19+
|> compile
1820
|> verifyBaseline
1921
|> verifyILBaseline
2022

tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpressions.fs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ module ComputationExpressions =
3030
|> withEmbeddedPdb
3131
|> withEmbedAllSource
3232
|> ignoreWarnings
33+
|> typecheck
3334
|> verifyILBaseline
3435

3536
[<Theory; FileInlineData("ComputationExpr01.fs", Realsig=BooleanOptions.Both)>]
@@ -85,4 +86,5 @@ module ComputationExpressions =
8586
]
8687
|> withEmbeddedPdb
8788
|> withEmbedAllSource
89+
|> typecheck
8890
|> verifyILBaseline

tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ComputedCollections.fs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ module ComputedCollections =
1111
|> withEmbeddedPdb
1212
|> withEmbedAllSource
1313
|> ignoreWarnings
14+
|> compile
1415
|> verifyILBaseline
1516

1617
[<Theory; FileInlineData("Int32RangeArrays.fs", Realsig = BooleanOptions.Both, Optimize = BooleanOptions.True)>]

0 commit comments

Comments
 (0)