From fcfd2245f29772f20ce4a4b2d69fba9934465127 Mon Sep 17 00:00:00 2001
From: Eugene Auduchinok <eugene.auduchinok@jetbrains.com>
Date: Fri, 6 Nov 2020 23:00:52 +0300
Subject: [PATCH] Check no modifier, explicit public modifier

---
 tests/service/Symbols.fs | 36 ++++++++++++++++++++++++++----------
 1 file changed, 26 insertions(+), 10 deletions(-)

diff --git a/tests/service/Symbols.fs b/tests/service/Symbols.fs
index b69a4161b0c..065511abab3 100644
--- a/tests/service/Symbols.fs
+++ b/tests/service/Symbols.fs
@@ -61,16 +61,32 @@ match "foo" with
 module ExternDeclarations =
     [<Test>]
     let ``Access modifier`` () =
-        let parseResults, checkResults = getParseAndCheckResults "extern int private f()"
-
-        match getSingleModuleLikeDecl parseResults.ParseTree with
-        | SynModuleOrNamespace (decls = [SynModuleDecl.Let (_, [Binding (accessibility = accessibility)], _)]) ->
-            accessibility |> should equal (Some SynAccess.Private)
-        | _ -> failwith "Couldn't get f"
-
-        match findSymbolByName "f" checkResults with
-        | :? FSharpMemberOrFunctionOrValue as mfv -> mfv.Accessibility.IsPrivate |> should equal true
-        | _ -> failwith "Couldn't get f"
+        let parseResults, checkResults = getParseAndCheckResults """
+extern int a()
+extern int public b()
+extern int private c()
+"""
+        let (SynModuleOrNamespace (decls = decls)) = getSingleModuleLikeDecl parseResults.ParseTree
+
+        [ None
+          Some SynAccess.Public
+          Some SynAccess.Private ]
+        |> List.zip decls
+        |> List.iter (fun (actual, (expected)) ->
+            match actual with
+            | SynModuleDecl.Let (_, [Binding (accessibility = access)], _) -> access |> should equal expected
+            | decl -> failwithf "unexpected decl: %O" decl)
+
+        [ "a", (true, false, false, false)
+          "b", (true, false, false, false)
+          "c", (false, false, false, true) ]
+        |> List.iter (fun (name, expectedAccess) ->
+            match findSymbolByName name checkResults with
+            | :? FSharpMemberOrFunctionOrValue as mfv ->
+                let access = mfv.Accessibility
+                (access.IsPublic, access.IsProtected, access.IsInternal, access.IsPrivate)
+                |> should equal expectedAccess
+            | _ -> failwith "Couldn't get f")
 
 
 module XmlDocSig =