Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinRansom committed Nov 20, 2024
1 parent e44ae1d commit 183b9c5
Show file tree
Hide file tree
Showing 25 changed files with 1,400 additions and 1,235 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,6 @@ tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstanda
/tests/AheadOfTime/Trimming/output.txt
*.svclog
micro.exe
positive.exe
positive.exe
/tests/FSharp.Compiler.ComponentTests/FSharpChecker/StandardError.txt
/tests/FSharp.Compiler.ComponentTests/FSharpChecker/StandardOutput.txt
27 changes: 27 additions & 0 deletions DEVGUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,33 @@ Linux/macOS:
export TEST_UPDATE_BSL=1
```

## Retain Test run built artifacts

When investigating tests issues it is sometimes usefull to examine the artifacts built whe running tests. Those built using the newer test framework are usually,
built in the %TEMP%\FSharp.Test.Utilities subdirectory.

To tell the test framework to not cleanup these files use the: FSHARP_RETAIN_TESTBUILDS environment variable

Windows:

CMD:

```shell
set FSHARP_RETAIN_TESTBUILDS=1
```

PowerShell:

```shell
$env:FSHARP_RETAIN_TESTBUILDS=1
```

Linux/macOS:

```shell
export FSHARP_RETAIN_TESTBUILDS=1
```

Next, run a build script build (debug or release, desktop or coreclr, depending which baselines you need to update), and test as described [above](#Testing-from-the-command-line). For example:

`./Build.cmd -c Release -testCoreClr` to update Release CoreCLR baselines.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,43 @@ module SymbolicOperators =

// This test was automatically generated (moved from FSharpQA suite - Conformance/LexicalAnalysis/SymbolicOperators)
//<Expects status="error" id="FS0670">This code is not sufficiently generic\. The type variable \^T when \^T : \(static member \( \+ \) : \^T \* \^T -> \^a\) could not be generalized because it would escape its scope</Expects>
[<Theory; Directory(__SOURCE_DIRECTORY__ + "/../../resources/tests/Conformance/LexicalAnalysis/SymbolicOperators", Includes=[|"E_LessThanDotOpenParen001.fs"|])>]
let ``SymbolicOperators - E_LessThanDotOpenParen001_fs - --flaterrors`` compilation =
compilation
|> asFsx
[<InlineData(true)>] // RealSig
[<InlineData(false)>] // Regular
[<Theory>]
let ``SymbolicOperators_E_LessThanDotOpenParen001_fs`` (realsig) =
Fsx """// #Regression #Conformance #LexicalAnalysis #Operators
// Regression test for FSHARP1.0:4805
// We are not really after the actual error messages here (some of them have been omitted), rather we
// want to verify we do not crash!
//<Expects status="warning" id="FS0064">This construct causes code to be less generic than indicated by the type annotations\. The type variable 'S has been constrained to be type 'int'</Expects>
//<Expects status="error" id="FS0670">This code is not sufficiently generic\. The type variable \^T when \^T : \(static member \( \+ \) : \^T \* \^T -> \^a\) could not be generalized because it would escape its scope</Expects>
type public TestType<'T,'S>() =
member public s.Value with get() = Unchecked.defaultof<'T>
static member public (+++) (a : TestType<'T,'S>, b : TestType<'T,'S>) = a.Value
static member public (+++) (a : TestType<'T,'S>, b : 'T) = b
static member public (+++) (a : 'T, b : TestType<'T,'S>) = a
static member public (+++) (a : TestType<'T,'S>, b : 'T -> 'S) = a.Value
static member public (+++) (a : 'S -> 'T, b : TestType<'T,'S>) = (a 17) + b.Value
let inline (+++) (a : ^a) (b : ^b) = ((^a or ^b): (static member (+++): ^a * ^b -> ^c) (a,b) )
let tt0 = TestType<int, string>()
let tt1 = TestType<int, string>()
let f (x : string) = 18
let a0 = tt0 +++ tt1
let a1 = tt0 +++ 11
let a2 = 12 +++ tt1
let a3 = tt0 +++ (fun x -> "18")
let a4 = f +++ tt0
let a5 = TestType<int, string>.(+++)(f, tt0)
let a6 = TestType<int, string>.(+++)((fun (x : string) -> 18), tt0)"""
|> withOptions ["--flaterrors"]
|> withRealInternalSignature realsig
|> compile
|> shouldFail
|> withErrorCode 0670
Expand Down
Loading

0 comments on commit 183b9c5

Please sign in to comment.