Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ launchSettings.json
*.jrs
*.chk
*.bak
*.out
*.vserr
*.err
*.orig
Expand Down

This file was deleted.

11 changes: 3 additions & 8 deletions tests/FSharp.Compiler.Service.Tests/SurfaceArea.fs
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,14 @@ type SurfaceAreaTest() =

[<Fact>]
member _.VerifySurfaceAreaFSharpCompilerService() =
// System.Environment.SetEnvironmentVariable("TEST_UPDATE_BSL", "1")

let platform = "netstandard20"

let flavor =
#if DEBUG
"debug"
#else
"release"
#endif
let assembly =
let path = Path.Combine(Path.GetDirectoryName(typeof<int list>.Assembly.Location), "FSharp.Compiler.Service.dll")
Assembly.LoadFrom path

let baseline = Path.Combine(__SOURCE_DIRECTORY__, $"FSharp.Compiler.Service.SurfaceArea.{platform}.{flavor}.bsl")
let outFileName = $"FSharp.Compiler.Service.SurfaceArea.{platform}.{flavor}.out"
let baseline = Path.Combine(__SOURCE_DIRECTORY__, $"FSharp.Compiler.Service.SurfaceArea.{platform}.bsl")
let outFileName = Path.Combine(__SOURCE_DIRECTORY__, $"FSharp.Compiler.Service.SurfaceArea.{platform}.out")
FSharp.Test.SurfaceArea.verify assembly baseline outFileName
5 changes: 2 additions & 3 deletions tests/FSharp.Core.UnitTests/SurfaceArea.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace FSharp.Core.UnitTests.Portable.SurfaceArea

open Xunit
open System
open System.IO
open FSharp.Test

Expand Down Expand Up @@ -39,5 +38,5 @@ type SurfaceAreaTest() =
#endif
let assembly = typeof<int list>.Assembly
let baseline = Path.Combine(__SOURCE_DIRECTORY__, $"FSharp.Core.SurfaceArea.{platform}.{flavor}.bsl")
let outFileName = $"FSharp.Core.SurfaceArea.{platform}.{flavor}.out"
FSharp.Test.SurfaceArea.verify assembly baseline outFileName
let outFileName = Path.Combine(Path.GetDirectoryName(assembly.Location), $"FSharp.Core.SurfaceArea.{platform}.{flavor}.out")
SurfaceArea.verify assembly baseline outFileName
32 changes: 15 additions & 17 deletions tests/FSharp.Test.Utilities/SurfaceArea.fs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ module FSharp.Test.SurfaceArea
let private appendNewLine str = str + System.Environment.NewLine

// verify public surface area matches expected, handles baseline update when TEST_UPDATE_BSL is set
let verify assembly baselinePath outFileName : unit =

let verify assembly baselinePath outFilePath : unit =
let expected =
File.ReadAllLines(baselinePath)
|> String.concat System.Environment.NewLine
Expand All @@ -62,24 +61,23 @@ module FSharp.Test.SurfaceArea

let expected = normalize expected

let logFile =
Path.Combine(Path.GetDirectoryName(assembly.Location), outFileName)

File.WriteAllText(logFile, actual)

match Assert.shouldBeSameMultilineStringSets expected actual with
| None -> ()
| None ->
File.Delete(outFilePath)

| Some diff ->
// Update baselines here
match Environment.GetEnvironmentVariable("TEST_UPDATE_BSL") with
| null -> ()
| _ -> File.Copy(logFile, baselinePath, true)
let msg = $"""Assembly: %A{asm}
| null ->
File.WriteAllText(outFilePath, actual)

let msg = $"""Assembly: %A{asm}

Expected and actual surface area don't match. To see the delta, run:
windiff {baselinePath} {logFile}
Expected and actual surface area don't match. To see the delta, run:
windiff {baselinePath} {outFilePath}

{diff}"""
{diff}"""

failwith msg
failwith msg
| _ ->
File.Delete(outFilePath)
File.WriteAllText(baselinePath, actual)
Loading