forked from dotnet/fsharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUncoveredOptions.fs
More file actions
109 lines (95 loc) · 3.69 KB
/
UncoveredOptions.fs
File metadata and controls
109 lines (95 loc) · 3.69 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
namespace CompilerOptions.Fsc
open Xunit
open FSharp.Test.Compiler
/// Smoke tests for compiler options that have no dedicated test coverage
module UncoveredOptions =
// =================================================================
// Switch options (+/-) — verify parser accepts both polarities
// =================================================================
[<Theory>]
[<InlineData("--realsig+")>]
[<InlineData("--realsig-")>]
[<InlineData("--compressmetadata+")>]
[<InlineData("--compressmetadata-")>]
[<InlineData("--checknulls+")>]
[<InlineData("--checknulls-")>]
[<InlineData("--strict-indentation+")>]
[<InlineData("--strict-indentation-")>]
[<InlineData("--quotations-debug+")>]
[<InlineData("--quotations-debug-")>]
[<InlineData("--tailcalls+")>]
[<InlineData("--tailcalls-")>]
[<InlineData("--deterministic+")>]
[<InlineData("--deterministic-")>]
let ``switch options are accepted by the parser`` (option: string) =
Fs """module M"""
|> withOptions [option]
|> ignoreWarnings
|> typecheck
|> shouldSucceed
|> ignore
// =================================================================
// Unit options (no argument) — verify parser accepts them
// =================================================================
[<Theory>]
[<InlineData("--nooptimizationdata")>]
[<InlineData("--nointerfacedata")>]
[<InlineData("--nocopyfsharpcore")>]
[<InlineData("--nowin32manifest")>]
[<InlineData("--allsigs")>] // typecheck only — compile would write .fsi files
[<InlineData("--utf8output")>]
[<InlineData("--fullpaths")>]
let ``unit options are accepted by the parser`` (option: string) =
Fs """module M"""
|> withOptions [option]
|> ignoreWarnings
|> typecheck
|> shouldSucceed
|> ignore
// =================================================================
// String options with valid values — verify parser + compilation
// =================================================================
[<Theory>]
[<InlineData("SHA1")>]
[<InlineData("SHA256")>]
let ``checksumalgorithm with valid algorithm is accepted`` (algorithm: string) =
Fs """module M"""
|> withOptions [$"--checksumalgorithm:{algorithm}"]
|> compile
|> shouldSucceed
|> ignore
[<Theory>]
[<InlineData("--target:exe")>]
[<InlineData("--target:winexe")>]
[<InlineData("--target:library")>]
[<InlineData("--target:module")>]
let ``target with valid values is accepted`` (option: string) =
Fs """module M"""
|> withOptions [option]
|> ignoreWarnings
|> compile
|> shouldSucceed
|> ignore
// =================================================================
// Compilation modes
// =================================================================
[<Fact>]
let ``parseonly does not report type errors`` () =
Fs """let x: int = "not an int" """
|> asExe
|> withOptions ["--parseonly"]
|> ignoreWarnings
|> compile
|> shouldSucceed
|> ignore
// =================================================================
// Diagnostic format options
// =================================================================
[<Fact>]
let ``maxerrors with valid value is accepted`` () =
Fs """module M"""
|> withOptions ["--maxerrors:10"]
|> compile
|> shouldSucceed
|> ignore