Skip to content

Commit a816851

Browse files
Moved some fsharpqa Test Cases over to NUnit (#9254)
* Migrated 'missing expression after let' testcase * Fixed naming of file * Migrated 'Wrong Numeric Literal' testcase * Moved new files to bottom in folder * Migrated 'module abbreviations are always private' testcase * Fixed test naming * Unlisted migrated testcases from env.lst
1 parent 537a8fe commit a816851

8 files changed

Lines changed: 65 additions & 23 deletions

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
2+
3+
namespace FSharp.Compiler.UnitTests
4+
5+
open NUnit.Framework
6+
open FSharp.Compiler.SourceCodeServices
7+
8+
[<TestFixture>]
9+
module ``Invalid Numeric Literal`` =
10+
11+
[<Test>]
12+
let ``1up is invalid Numeric Literal``() =
13+
CompilerAssert.TypeCheckSingleError
14+
"""
15+
let foo = 1up // int
16+
"""
17+
FSharpErrorSeverity.Error
18+
1156
19+
(2, 11, 2, 14)
20+
"This is not a valid numeric literal. Valid numeric literals include 1, 0x1, 0o1, 0b1, 1l (int), 1u (uint32), 1L (int64), 1UL (uint64), 1s (int16), 1y (sbyte), 1uy (byte), 1.0 (float), 1.0f (float32), 1.0m (decimal), 1I (BigInteger)."
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
2+
3+
namespace FSharp.Compiler.UnitTests
4+
5+
open NUnit.Framework
6+
open FSharp.Compiler.SourceCodeServices
7+
8+
[<TestFixture>]
9+
module ``Missing Expression`` =
10+
11+
[<Test>]
12+
let ``Missing Expression after let``() =
13+
CompilerAssert.TypeCheckSingleError
14+
"""
15+
let sum = 0
16+
for x in 0 .. 10 do
17+
let sum = sum + x
18+
"""
19+
FSharpErrorSeverity.Error
20+
588
21+
(4,5,4,8)
22+
"The block following this 'let' is unfinished. Every code block is an expression and must have a result. 'let' cannot be the final code element in a block. Consider giving this block an explicit result."
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
2+
3+
namespace FSharp.Compiler.UnitTests
4+
5+
open NUnit.Framework
6+
open FSharp.Compiler.SourceCodeServices
7+
8+
[<TestFixture>]
9+
module ``Module Abbreviations`` =
10+
11+
[<Test>]
12+
let ``Public Module Abbreviation``() =
13+
CompilerAssert.TypeCheckSingleError
14+
"""
15+
module public L1 = List
16+
"""
17+
FSharpErrorSeverity.Error
18+
536
19+
(2, 1, 2, 7)
20+
"The 'Public' accessibility attribute is not allowed on module abbreviation. Module abbreviations are always private."

tests/fsharp/FSharpSuite.Tests.fsproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@
5252
<Compile Include="Compiler\ErrorMessages\WrongSyntaxInForLoop.fs" />
5353
<Compile Include="Compiler\ErrorMessages\WarnExpressionTests.fs" />
5454
<Compile Include="Compiler\ErrorMessages\DontSuggestTests.fs" />
55+
<Compile Include="Compiler\ErrorMessages\MissingExpressionTests.fs" />
56+
<Compile Include="Compiler\ErrorMessages\InvalidNumericLiteralTests.fs" />
57+
<Compile Include="Compiler\ErrorMessages\ModuleAbbreviationTests.fs" />
5558
<Compile Include="Compiler\Warnings\AssignmentWarningTests.fs" />
5659
<Compile Include="Compiler\Warnings\ExperimentalAttributeTests.fs" />
5760
<Compile Include="Compiler\Warnings\PatternMatchingWarningTests.fs" />

tests/fsharpqa/Source/Warnings/MissingExpressionAfterLet.fs

Lines changed: 0 additions & 8 deletions
This file was deleted.

tests/fsharpqa/Source/Warnings/ModuleAbbreviationsArePrivate.fs

Lines changed: 0 additions & 6 deletions
This file was deleted.

tests/fsharpqa/Source/Warnings/WrongNumericLiteral.fs

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
1-
SOURCE=WrongNumericLiteral.fs # WrongNumericLiteral.fs
21
SOURCE=FS0988AtEndOfFile.fs # FS0988AtEndOfFile.fs
3-
SOURCE=MissingExpressionAfterLet.fs # MissingExpressionAfterLet.fs
42
SOURCE=Repro1548.fs SCFLAGS="-r:Repro1548.dll" # Repro1548.fs
5-
SOURCE=ModuleAbbreviationsArePrivate.fs

0 commit comments

Comments
 (0)