-
Notifications
You must be signed in to change notification settings - Fork 806
/
Copy pathVisualStudioVersusConsoleContextTests.fs
46 lines (37 loc) · 1.63 KB
/
VisualStudioVersusConsoleContextTests.fs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
module FSharp.Compiler.Service.Tests.VisualStudioVersusConsoleContextTests
open Xunit
open FSharp.Compiler.CompilerOptions
open TestDoubles
// copypasted from the CompilerOptions code,
// not worth changing that code's accessibility just for this test
let private getOptionsFromOptionBlocks blocks =
let GetOptionsOfBlock block =
match block with
| PublicOptions (_, opts) -> opts
| PrivateOptions opts -> opts
List.collect GetOptionsOfBlock blocks
[<Fact>] // controls https://github.com/dotnet/fsharp/issues/13549
let ``Console-only options are filtered out for fsc in the VS context`` () =
// just a random thing to make things work
let builder = getArbitraryTcConfigBuilder()
let blocks = GetCoreServiceCompilerOptions builder
let options = getOptionsFromOptionBlocks blocks
// this is a very whitebox testing but arguably better than nothing
Assert.False(
options
|> List.exists (function
| CompilerOption (_, _, OptionConsoleOnly _, _, _) -> true
| _ -> false))
// and a couple of shots in the dark
Assert.False(
options
|> List.exists (function
// ignore deprecated options
// one of them actually allows specifying the compiler version
| CompilerOption (name, _, _, None, _) -> name = "version"
| _ -> false))
Assert.False(
options
|> List.exists (function
| CompilerOption (name, _, _, _, _) -> name = "help"))