未验证 提交 d3fafb8c 编写于 作者: K Kevin Ransom (msft) 提交者: GitHub

Even more compileroptions (#14253)

* checked

* net7.0

* tweak

* cliversion

* foo
上级 558cca1a
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
namespace FSharp.Compiler.ComponentTests.CompilerOptions
open FSharp.Test
open FSharp.Test.Compiler
open Xunit
module Checked =
// SOURCE=unchecked01.fs # fsc-default
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"unchecked01.fs"|])>]
let ``fsc-unchecked - unchecked01.fs`` compilation =
compilation
|> asFs
|> compile
|> shouldSucceed
// SOURCE=checked01.fs SCFLAGS="--checked" # fsc-checked
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"unchecked01.fs"|])>]
let ``fsc-unchecked - unchecked01.fs --checked`` compilation =
compilation
|> asFs
|> withOptions["--checked"]
|> compile
|> shouldSucceed
// SOURCE=checked01.fs SCFLAGS="--checked+" # fsc-checked+
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"unchecked01.fs"|])>]
let ``fsc-unchecked - unchecked01.fs --checked+`` compilation =
compilation
|> asFs
|> withOptions["--checked+"]
|> compile
|> shouldSucceed
// SOURCE=unchecked01.fs SCFLAGS="--checked-" # fsc-checked-
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"unchecked01.fs"|])>]
let ``fsc-unchecked - unchecked01.fs --checked-`` compilation =
compilation
|> asFs
|> withOptions["--checked-"]
|> compile
|> shouldSucceed
// SOURCE=unchecked01.fs SCFLAGS="--checked-" # fsc-checked-
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"unchecked01.fs"|])>]
let ``fsi-unchecked - unchecked01.fs --checked-`` compilation =
compilation
|> asFsx
|> withOptions["--checked-"]
|> compile
|> shouldSucceed
// SOURCE=checked01.fs SCFLAGS="--checked" FSIMODE=EXEC COMPILE_ONLY=1 # fsi-checked
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"checked01.fs"|])>]
let ``fsi-checked - checked01.fs --checked`` compilation =
compilation
|> asFsx
|> withOptions["--checked"]
|> compile
|> shouldSucceed
// SOURCE=checked01.fs SCFLAGS="--checked+" FSIMODE=EXEC COMPILE_ONLY=1 # fsi-checked+
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"checked01.fs"|])>]
let ``fsi-checked - checked01.fs --checked+`` compilation =
compilation
|> asFsx
|> withOptions["--checked+"]
|> compile
|> shouldSucceed
// SOURCE=checked01.fs SCFLAGS="--checked-" FSIMODE=EXEC COMPILE_ONLY=1 # fsi-checked+
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"checked01.fs"|])>]
let ``fsi-checked - checked01.fs --checked-`` compilation =
compilation
|> asFsx
|> withOptions["--checked-"]
|> compile
|> shouldSucceed
//# Last one wins
// SOURCE=checked01.fs SCFLAGS="--checked --checked+" # fsc-checkedchecked+
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"checked01.fs"|])>]
let ``fsc-checked - checked01.fs --checked --checked+`` compilation =
compilation
|> asFs
|> withOptions["--checked"; "--checked+"]
|> compile
|> shouldSucceed
// SOURCE=checked01.fs SCFLAGS="--checked- --checked+" # fsc-checked-checked+
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"checked01.fs"|])>]
let ``fsc-checked - checked01.fs --checked- --checked+`` compilation =
compilation
|> asFs
|> withOptions["--checked-"; "--checked+"]
|> compile
|> shouldSucceed
// SOURCE=unchecked01.fs SCFLAGS="--checked+ --checked-" # fsc-checked+checked-
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"unchecked01.fs"|])>]
let ``fsc-checked - unchecked01.fs --checked+ --checked-`` compilation =
compilation
|> asFs
|> withOptions["--checked+"; "--checked-"]
|> compile
|> shouldSucceed
// SOURCE=checked01.fs SCFLAGS="--checked --checked+" # fsc-checkedchecked+
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"checked01.fs"|])>]
let ``fsi-checked - checked01.fs --checked --checked+`` compilation =
compilation
|> asFsx
|> withOptions["--checked"; "--checked+"]
|> compile
|> shouldSucceed
// SOURCE=checked01.fs SCFLAGS="--checked- --checked+" # fsc-checked-checked+
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"checked01.fs"|])>]
let ``fsi-checked - checked01.fs --checked- --checked+`` compilation =
compilation
|> asFsx
|> withOptions["--checked-"; "--checked+"]
|> compile
|> shouldSucceed
// SOURCE=unchecked01.fs SCFLAGS="--checked+ --checked-" # fsc-checked+checked-
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"unchecked01.fs"|])>]
let ``fsi-checked - unchecked01.fs --checked+ --checked-`` compilation =
compilation
|> asFsx
|> withOptions["--checked+"; "--checked-"]
|> compile
|> shouldSucceed
//# Unrecognized argument
// SOURCE=unrecogarg.fs SCFLAGS="--Checked" # fsc--Checked
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"unrecogarg.fs"|])>]
let ``fsc-checked - unchecked01.fs Checked`` compilation =
compilation
|> asFs
|> withOptions["--Checked"]
|> compile
|> shouldFail
|> withDiagnostics [
(Error 243, Line 0, Col 1, Line 0, Col 1, "Unrecognized option: '--Checked'")
]
// SOURCE=unrecogarg.fs SCFLAGS="--checked*" # fsc--checked*
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"unrecogarg.fs"|])>]
let ``fsc-checked - unchecked01.fs --checked-star`` compilation =
compilation
|> asFs
|> withOptions["--checked*"]
|> compile
|> shouldFail
|> withDiagnostics [
(Error 243, Line 0, Col 1, Line 0, Col 1, "Unrecognized option: '--checked*'")
]
// SOURCE=unrecogarg.fs SCFLAGS="--checked*" # fsc--checked*
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"UncheckedDefaultOf01.fs"|])>]
let ``fsc-checked - UncheckedDefaultOf01`` compilation =
compilation
|> asFs
|> asExe
|> compile
|> shouldSucceed
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
namespace FSharp.Compiler.ComponentTests.CompilerOptions
open Xunit
open FSharp.Test
open FSharp.Test.Compiler
module cliversion =
//# SOURCE=E_fsc_cliversion.fs SCFLAGS="--cliversion:2.0" # fsc --cliversion:2.0
[<Fact>]
let ``fsc --cliversion:2.0``() =
FSharp """
"""
|> asExe
|> withOptions ["--cliversion:2.0"]
|> compile
|> shouldFail
|> withDiagnostics [
(Error 243, Line 0, Col 1, Line 0, Col 1, "Unrecognized option: '--cliversion'")
]
//# SOURCE=E_fsi_cliversion.fs SCFLAGS="--cliversion:2.0" FSIMODE=EXEC COMPILE_ONLY=1 # fsi --cliversion:2.0
[<Fact>]
let ``fsi --cliversion:2.0``() =
FSharp """
"""
|> asFsx
|> withOptions ["--cliversion:2.0"]
|> compile
|> shouldFail
|> withDiagnostics [
(Error 243, Line 0, Col 1, Line 0, Col 1, "Unrecognized option: '--cliversion'")
]
......@@ -185,6 +185,8 @@
<Compile Include="Scripting\Interactive.fs" />
<Compile Include="TypeChecks\CheckDeclarationsTests.fs" />
<Compile Include="TypeChecks\ParallelCheckingWithSignatureFilesTests.fs" />
<Compile Include="CompilerOptions\fsc\checked\checked.fs" />
<Compile Include="CompilerOptions\fsc\cliversion.fs" />
<Compile Include="CompilerOptions\fsc\langversion.fs" />
<Compile Include="CompilerOptions\fsc\noframework\noframework.fs" />
<Compile Include="CompilerOptions\fsc\platform\platform.fs" />
......
......@@ -565,7 +565,7 @@ module rec CompilerAssertHelpers =
"tfm": "net7.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "6.0"
"version": "7.0"
}
}
}"""
......
......@@ -87,5 +87,5 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
<ItemGroup />
</Project>
......@@ -120,7 +120,6 @@ module Utilities =
<TargetFramework>$TARGETFRAMEWORK</TargetFramework>
<UseFSharpPreview>true</UseFSharpPreview>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
<DotnetFscCompilerPath>$DOTNETFSCCOMPILERPATH</DotnetFscCompilerPath>
</PropertyGroup>
<ItemGroup><Compile Include="Program.fs" /></ItemGroup>
......@@ -171,7 +170,6 @@ let main argv = 0"""
let pathToTemp = Path.Combine(pathToArtifacts, "Temp")
let projectDirectory = Path.Combine(pathToTemp,Guid.NewGuid().ToString() + ".tmp")
let pathToFSharpCore = typeof<RequireQualifiedAccessAttribute>.Assembly.Location
let dotNetFscCompilerPath = config.DOTNETFSCCOMPILERPATH
try
try
Directory.CreateDirectory(projectDirectory) |> ignore
......@@ -181,9 +179,9 @@ let main argv = 0"""
let directoryBuildTargetsFileName = Path.Combine(projectDirectory, "Directory.Build.targets")
let frameworkReferencesFileName = Path.Combine(projectDirectory, "FrameworkReferences.txt")
#if NETCOREAPP
File.WriteAllText(projectFileName, projectFile.Replace("$TARGETFRAMEWORK", "net7.0").Replace("$FSHARPCORELOCATION", pathToFSharpCore).Replace("$DOTNETFSCCOMPILERPATH", dotNetFscCompilerPath))
File.WriteAllText(projectFileName, projectFile.Replace("$TARGETFRAMEWORK", "net7.0").Replace("$FSHARPCORELOCATION", pathToFSharpCore))
#else
File.WriteAllText(projectFileName, projectFile.Replace("$TARGETFRAMEWORK", "net472").Replace("$FSHARPCORELOCATION", pathToFSharpCore).Replace("$DOTNETFSCCOMPILERPATH", dotNetFscCompilerPath))
File.WriteAllText(projectFileName, projectFile.Replace("$TARGETFRAMEWORK", "net472").Replace("$FSHARPCORELOCATION", pathToFSharpCore))
#endif
File.WriteAllText(programFsFileName, programFs)
File.WriteAllText(directoryBuildPropsFileName, directoryBuildProps)
......
# Functional:
SOURCE=unchecked01.fs # fsc-default
SOURCE=checked01.fs SCFLAGS="--checked" # fsc-checked
SOURCE=checked01.fs SCFLAGS="--checked+" # fsc-checked+
SOURCE=unchecked01.fs SCFLAGS="--checked-" # fsc-checked-
SOURCE=unchecked01.fs FSIMODE=EXEC COMPILE_ONLY=1 # fsi-default
SOURCE=checked01.fs SCFLAGS="--checked" FSIMODE=EXEC COMPILE_ONLY=1 # fsi-checked
SOURCE=checked01.fs SCFLAGS="--checked+" FSIMODE=EXEC COMPILE_ONLY=1 # fsi-checked+
SOURCE=unchecked01.fs SCFLAGS="--checked-" FSIMODE=EXEC COMPILE_ONLY=1 # fsi-checked-
# Last one wins
SOURCE=checked01.fs SCFLAGS="--checked --checked+" # fsc-checkedchecked+
SOURCE=checked01.fs SCFLAGS="--checked- --checked+" # fsc-checked-checked+
SOURCE=unchecked01.fs SCFLAGS="--checked+ --checked-" # fsc-checked+checked-
SOURCE=checked01.fs SCFLAGS="--checked --checked+" FSIMODE=EXEC COMPILE_ONLY=1 # fsi-checkedchecked+
SOURCE=checked01.fs SCFLAGS="--checked- --checked+" FSIMODE=EXEC COMPILE_ONLY=1 # fsi-checked-checked+
SOURCE=unchecked01.fs SCFLAGS="--checked+ --checked-" FSIMODE=EXEC COMPILE_ONLY=1 # fsi-checked+checked-
# Unrecognized argument
SOURCE=unrecogarg.fs SCFLAGS="--Checked" # fsc--Checked
SOURCE=unrecogarg.fs SCFLAGS="--checked*" # fsc--checked*
SOURCE=unrecogarg.fs SCFLAGS="--Checked" FSIMODE=EXEC COMPILE_ONLY=1 # fsi--Checked
SOURCE=unrecogarg.fs SCFLAGS="--checked*" FSIMODE=EXEC COMPILE_ONLY=1 # fsi--checked*
SOURCE=UncheckedDefaultOf01.fs # UncheckedDefaultOf01
// #Regression #NoMT #CompilerOptions
//<Expects id="FS0243" status="error">Unrecognized option: '--cliversion'</Expects>
exit 0
// #Regression #NoMT #CompilerOptions
//<Expects id="FS0243" status="error">Unrecognized option: '--cliversion'</Expects>
#q;;
SOURCE=E_fsc_cliversion.fs SCFLAGS="--cliversion:2.0" # fsc --cliversion:2.0
SOURCE=E_fsi_cliversion.fs SCFLAGS="--cliversion:2.0" FSIMODE=EXEC COMPILE_ONLY=1 # fsi --cliversion:2.0
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册