Skip to content

Commit bdcb444

Browse files
Fix test case (#13782)
Co-authored-by: Vlad Zarytovskii <[email protected]>
1 parent b7d2c75 commit bdcb444

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

tests/FSharp.Compiler.Service.Tests/ConsoleOnlyOptionsTests.fs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,21 @@ open TestDoubles
1111
[<Test>]
1212
[<Ignore "Failing in main, disabling until resolved">]
1313
let ``Help is displayed correctly`` () =
14+
try
15+
if System.Console.BufferWidth < 80 then
16+
System.Console.BufferWidth <- 80
17+
with _ -> ()
18+
1419
let builder = getArbitraryTcConfigBuilder()
20+
builder.showBanner <- false // We don't need the banner
21+
1522
let blocks = GetCoreFscCompilerOptions builder
16-
let expectedHelp = File.ReadAllText $"{__SOURCE_DIRECTORY__}/expected-help-output.txt"
1723

24+
let expectedHelp = File.ReadAllText $"{__SOURCE_DIRECTORY__}/expected-help-output.bsl"
1825
let help = GetHelpFsc builder blocks
1926

20-
// contains instead of equals
21-
// as we don't control the 1st line of the output (the version)
22-
// it's tested separately
23-
StringAssert.Contains(expectedHelp, help.Replace("\r\n", Environment.NewLine))
27+
let actualHelp = help.Replace("\r\n", Environment.NewLine)
28+
Assert.AreEqual(expectedHelp, actualHelp, $"Console width: {System.Console.BufferWidth}\nExpected: {expectedHelp}\n Actual: {actualHelp}") |> ignore
2429

2530
[<Test>]
2631
let ``Version is displayed correctly`` () =

tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
</PropertyGroup>
2121

2222
<ItemGroup>
23-
<Content Include="expected-help-output.txt">
23+
<Content Include="expected-help-output.bsl">
2424
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
2525
</Content>
2626
<Compile Include="..\fsharp\TestHelpers.fs" Link="TestHelpers.fs" />

tests/FSharp.Compiler.Service.Tests/expected-help-output.txt renamed to tests/FSharp.Compiler.Service.Tests/expected-help-output.bsl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
Copyright (c) Microsoft Corporation. All Rights Reserved.
2-
1+
32

43
- OUTPUT FILES -
54
--out:<file> Name of the output file (Short form:
@@ -23,6 +22,8 @@
2322
run on: x86, x64, Arm, Arm64,
2423
Itanium, anycpu32bitpreferred, or
2524
anycpu. The default is anycpu.
25+
--compressmetadata[+|-] Compress interface and optimization
26+
data files
2627
--nooptimizationdata Only include optimization
2728
information essential for
2829
implementing inlined constructs.

0 commit comments

Comments
 (0)