From 3ce8eb1b2a4f8cfa29bb614ef8bb12e6a2fa67e0 Mon Sep 17 00:00:00 2001 From: Sergey Tihon Date: Mon, 29 Jul 2019 06:34:39 +0300 Subject: [PATCH] Moved Don't Suggest Tests over to NUnit (#7288) --- .../ErrorMessages/DontSuggestTests.fs | 48 +++++++++++++++++++ tests/fsharp/FSharpSuite.Tests.fsproj | 1 + .../DontSuggestCompletelyWrongStuff.fs | 7 --- ...DontSuggestIntentionallyUnusedVariables.fs | 8 ---- .../Warnings/DontSuggestWhenThingsAreOpen.fs | 13 ----- tests/fsharpqa/Source/Warnings/env.lst | 3 -- 6 files changed, 49 insertions(+), 31 deletions(-) create mode 100644 tests/fsharp/Compiler/ErrorMessages/DontSuggestTests.fs delete mode 100644 tests/fsharpqa/Source/Warnings/DontSuggestCompletelyWrongStuff.fs delete mode 100644 tests/fsharpqa/Source/Warnings/DontSuggestIntentionallyUnusedVariables.fs delete mode 100644 tests/fsharpqa/Source/Warnings/DontSuggestWhenThingsAreOpen.fs diff --git a/tests/fsharp/Compiler/ErrorMessages/DontSuggestTests.fs b/tests/fsharp/Compiler/ErrorMessages/DontSuggestTests.fs new file mode 100644 index 000000000..0e5a4f195 --- /dev/null +++ b/tests/fsharp/Compiler/ErrorMessages/DontSuggestTests.fs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace FSharp.Compiler.UnitTests + +open NUnit.Framework +open FSharp.Compiler.SourceCodeServices + +[] +module ``Don't Suggest`` = + + [] + let ``Dont Suggest Completely Wrong Stuff``() = + CompilerAssert.TypeCheckSingleError + """ +let _ = Path.GetFullPath "images" + """ + FSharpErrorSeverity.Error + 39 + (2, 9, 2, 13) + "The value, namespace, type or module 'Path' is not defined." + + [] + let ``Dont Suggest When Things Are Open``() = + CompilerAssert.ParseWithErrors + """ +module N = + let name = "hallo" + +type T = + static member myMember = 1 + +let x = N. + """ + [| + FSharpErrorSeverity.Error, 599, (8, 10, 8, 11), "Missing qualification after '.'" + FSharpErrorSeverity.Error, 222, (2, 1, 3, 1), "Files in libraries or multiple-file applications must begin with a namespace or module declaration. When using a module declaration at the start of a file the '=' sign is not allowed. If this is a top-level module, consider removing the = to resolve this error." + |] + + [] + let ``Dont Suggest Intentionally Unused Variables``() = + CompilerAssert.TypeCheckSingleError + """ +let hober xy _xyz = xyz + """ + FSharpErrorSeverity.Error + 39 + (2, 21, 2, 24) + "The value or constructor 'xyz' is not defined." diff --git a/tests/fsharp/FSharpSuite.Tests.fsproj b/tests/fsharp/FSharpSuite.Tests.fsproj index 71fd78680..21b9367ec 100644 --- a/tests/fsharp/FSharpSuite.Tests.fsproj +++ b/tests/fsharp/FSharpSuite.Tests.fsproj @@ -46,6 +46,7 @@ + diff --git a/tests/fsharpqa/Source/Warnings/DontSuggestCompletelyWrongStuff.fs b/tests/fsharpqa/Source/Warnings/DontSuggestCompletelyWrongStuff.fs deleted file mode 100644 index 68b6d6dcb..000000000 --- a/tests/fsharpqa/Source/Warnings/DontSuggestCompletelyWrongStuff.fs +++ /dev/null @@ -1,7 +0,0 @@ -// #Warnings -//The value, namespace, type or module 'Path' is not defined. -//Maybe you want one of the following:\s+Math - -let _ = Path.GetFullPath "images" - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/DontSuggestIntentionallyUnusedVariables.fs b/tests/fsharpqa/Source/Warnings/DontSuggestIntentionallyUnusedVariables.fs deleted file mode 100644 index 602d459d5..000000000 --- a/tests/fsharpqa/Source/Warnings/DontSuggestIntentionallyUnusedVariables.fs +++ /dev/null @@ -1,8 +0,0 @@ -//The value or constructor 'xyz' is not defined. -//Maybe you want one of the following: -//\s+xy -//\s+_xyz - -let hober xy _xyz = xyz - -exit 0 diff --git a/tests/fsharpqa/Source/Warnings/DontSuggestWhenThingsAreOpen.fs b/tests/fsharpqa/Source/Warnings/DontSuggestWhenThingsAreOpen.fs deleted file mode 100644 index dad90178a..000000000 --- a/tests/fsharpqa/Source/Warnings/DontSuggestWhenThingsAreOpen.fs +++ /dev/null @@ -1,13 +0,0 @@ -// #Warnings -//Missing qualification after '.' - -module N = - let name = "hallo" - -type T = - static member myMember = 1 - -let x = N. - - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/env.lst b/tests/fsharpqa/Source/Warnings/env.lst index 2daa6d316..275959c69 100644 --- a/tests/fsharpqa/Source/Warnings/env.lst +++ b/tests/fsharpqa/Source/Warnings/env.lst @@ -16,10 +16,8 @@ SOURCE=SuggestUnionCases.fs SCFLAGS="--vserrors" # SuggestUnionCases.fs SOURCE=SuggestArrayModuleFunctions.fs SCFLAGS="--vserrors" # SuggestArrayModuleFunctions.fs SOURCE=SuggestTypesInNamespace.fs # SuggestTypesInNamespace.fs - SOURCE=DontSuggestCompletelyWrongStuff.fs SCFLAGS="--vserrors" # DontSuggestCompletelyWrongStuff.fs SOURCE=SuggestTypesInNamespaceVS.fs SCFLAGS="--vserrors" # SuggestTypesInNamespaceVS.fs SOURCE=SuggestAsyncModule.fs SCFLAGS="--vserrors" # SuggestAsyncModule.fs - SOURCE=DontSuggestWhenThingsAreOpen.fs SCFLAGS="--vserrors" # DontSuggestWhenThingsAreOpen.fs SOURCE=SuggestDoubleBacktickIdentifiers.fs SCFLAGS="--vserrors" # SuggestDoubleBacktickIdentifiers.fs SOURCE=SuggestDoubleBacktickUnions.fs SCFLAGS="--vserrors" # SuggestDoubleBacktickUnions.fs SOURCE=MissingExpressionAfterLet.fs # MissingExpressionAfterLet.fs @@ -28,4 +26,3 @@ SOURCE=SuggestToUseIndexer.fs # SuggestToUseIndexer.fs SOURCE=Repro1548.fs SCFLAGS="-r:Repro1548.dll" # Repro1548.fs SOURCE=ModuleAbbreviationsArePrivate.fs - SOURCE=DontSuggestIntentionallyUnusedVariables.fs SCFLAGS="--vserrors" # DontSuggestIntentionallyUnusedVariables.fs