Skip to content

Commit 11c5ff4

Browse files
abelbraaksmabaronfel
authored andcommitted
Make sure both smoke tests use the same filterhack function
1 parent 02da892 commit 11c5ff4

1 file changed

Lines changed: 20 additions & 27 deletions

File tree

tests/service/ExprTests.fs

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,18 @@ module internal Utils =
6767
let getTempFilePathChangeExt tmp ext =
6868
Path.Combine(getTempPath(), Path.ChangeExtension(tmp, ext))
6969

70+
// This behaves slightly differently on Mono versions, 'null' is printed somethimes, 'None' other times
71+
// Presumably this is very small differences in Mono reflection causing F# printing to change behaviour
72+
// For now just disabling this test. See https://github.com/fsharp/FSharp.Compiler.Service/pull/766
73+
let filterHack l =
74+
l |> List.map (fun (s:string) ->
75+
// potential difference on Mono
76+
s.Replace("ILArrayShape [(Some 0, None)]", "ILArrayShape [(Some 0, null)]")
77+
// spacing difference when run locally in VS
78+
.Replace("I_ldelema (NormalAddress,false,ILArrayShape [(Some 0, null)],!0)]", "I_ldelema (NormalAddress, false, ILArrayShape [(Some 0, null)], !0)]")
79+
// local VS IDE vs CI env difference
80+
.Replace("Operators.Hash<Microsoft.FSharp.Core.string> (x)", "x.GetHashCode()"))
81+
7082
let rec printExpr low (e:FSharpExpr) =
7183
match e with
7284
| BasicPatterns.AddressOf(e1) -> "&"+printExpr 0 e1
@@ -709,15 +721,6 @@ let ``Test Unoptimized Declarations Project1`` () =
709721
let file1 = wholeProjectResults.AssemblyContents.ImplementationFiles.[0]
710722
let file2 = wholeProjectResults.AssemblyContents.ImplementationFiles.[1]
711723

712-
// This behaves slightly differently on Mono versions, 'null' is printed somethimes, 'None' other times
713-
// Presumably this is very small differences in Mono reflection causing F# printing to change behavious
714-
// For now just disabling this test. See https://github.com/fsharp/FSharp.Compiler.Service/pull/766
715-
let filterHack l =
716-
l |> List.map (fun (s:string) ->
717-
s.Replace("ILArrayShape [(Some 0, None)]", "ILArrayShapeFIX")
718-
.Replace("ILArrayShape [(Some 0, null)]", "ILArrayShapeFIX")
719-
.Replace("Operators.Hash<Microsoft.FSharp.Core.string> (x)", "x.GetHashCode()"))
720-
721724
let expected = [
722725
"type M"; "type IntAbbrev"; "let boolEx1 = True @ (6,14--6,18)";
723726
"let intEx1 = 1 @ (7,13--7,14)"; "let int64Ex1 = 1 @ (8,15--8,17)";
@@ -824,13 +827,13 @@ let ``Test Unoptimized Declarations Project1`` () =
824827

825828
printDeclarations None (List.ofSeq file1.Declarations)
826829
|> Seq.toList
827-
|> filterHack
828-
|> shouldPairwiseEqual (filterHack expected)
830+
|> Utils.filterHack
831+
|> shouldPairwiseEqual (Utils.filterHack expected)
829832

830833
printDeclarations None (List.ofSeq file2.Declarations)
831834
|> Seq.toList
832-
|> filterHack
833-
|> shouldPairwiseEqual (filterHack expected2)
835+
|> Utils.filterHack
836+
|> shouldPairwiseEqual (Utils.filterHack expected2)
834837

835838
()
836839

@@ -850,16 +853,6 @@ let ``Test Optimized Declarations Project1`` () =
850853
let file1 = wholeProjectResults.GetOptimizedAssemblyContents().ImplementationFiles.[0]
851854
let file2 = wholeProjectResults.GetOptimizedAssemblyContents().ImplementationFiles.[1]
852855

853-
// This behaves slightly differently on Mono versions, 'null' is printed somethimes, 'None' other times
854-
// Presumably this is very small differences in Mono reflection causing F# printing to change behaviour
855-
// For now just disabling this test. See https://github.com/fsharp/FSharp.Compiler.Service/pull/766
856-
let filterHack l =
857-
l |> List.map (fun (s:string) ->
858-
// potential difference on Mono
859-
s.Replace("ILArrayShape [(Some 0, None)]", "ILArrayShape [(Some 0, null)]")
860-
// spacing difference when run locally in VS
861-
.Replace("I_ldelema (NormalAddress,false,ILArrayShape [(Some 0, null)],!0)]", "I_ldelema (NormalAddress, false, ILArrayShape [(Some 0, null)], !0)]"))
862-
863856
let expected = [
864857
"type M"; "type IntAbbrev"; "let boolEx1 = True @ (6,14--6,18)";
865858
"let intEx1 = 1 @ (7,13--7,14)"; "let int64Ex1 = 1 @ (8,15--8,17)";
@@ -968,13 +961,13 @@ let ``Test Optimized Declarations Project1`` () =
968961

969962
printDeclarations None (List.ofSeq file1.Declarations)
970963
|> Seq.toList
971-
|> filterHack
972-
|> shouldPairwiseEqual (filterHack expected)
964+
|> Utils.filterHack
965+
|> shouldPairwiseEqual (Utils.filterHack expected)
973966

974967
printDeclarations None (List.ofSeq file2.Declarations)
975968
|> Seq.toList
976-
|> filterHack
977-
|> shouldPairwiseEqual (filterHack expected2)
969+
|> Utils.filterHack
970+
|> shouldPairwiseEqual (Utils.filterHack expected2)
978971

979972
()
980973

0 commit comments

Comments
 (0)