Skip to content

Commit 4666ce8

Browse files
author
7sharp9
committed
Updated corresponding tests for ReturnParameter
1 parent bf5e138 commit 4666ce8

File tree

1 file changed

+25
-8
lines changed

1 file changed

+25
-8
lines changed

tests/service/ProjectAnalysisTests.fs

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4336,9 +4336,9 @@ module Project35 =
43364336
let fileSource1 = """
43374337
type Test =
43384338
let curriedFunction (one:int) (two:float) (three:string) =
4339-
one + int two + int three
4339+
float32 (one + int two + int three)
43404340
let tupleFunction (one:int, two:float, three:string) =
4341-
one + int two + int three
4341+
float32 (one + int two + int three)
43424342
"""
43434343
File.WriteAllText(fileName1, fileSource1)
43444344
let cleanFileName a = if a = fileName1 then "file1" else "??"
@@ -4356,32 +4356,49 @@ let ``Test project35 CurriedParameterGroups should be available for nested funct
43564356
Array.find (fun (su:FSharpSymbolUse) -> su.Symbol.DisplayName = name)
43574357

43584358
let curriedFunction = allSymbolUses |> findByDisplayName "curriedFunction"
4359+
43594360
match curriedFunction.Symbol with
43604361
| :? FSharpMemberOrFunctionOrValue as mfv ->
4362+
43614363
let curriedParamGroups =
43624364
mfv.CurriedParameterGroups
43634365
|> Seq.map Seq.toList
43644366
|> Seq.toList
4367+
4368+
//check the parameters
43654369
match curriedParamGroups with
43664370
| [[param1];[param2];[param3]] ->
4367-
param1.Type.TypeDefinition.DisplayName |> should equal "int"
4368-
param2.Type.TypeDefinition.DisplayName |> should equal "float"
4369-
param3.Type.TypeDefinition.DisplayName |> should equal "string"
4371+
param1.Type.TypeDefinition.DisplayName |> shouldEqual "int"
4372+
param2.Type.TypeDefinition.DisplayName |> shouldEqual "float"
4373+
param3.Type.TypeDefinition.DisplayName |> shouldEqual "string"
43704374
| _ -> failwith "Unexpected parameters"
4375+
4376+
//now check the return type
4377+
let retTyp = mfv.ReturnParameter
4378+
retTyp.Type.TypeDefinition.DisplayName |> shouldEqual "float32"
4379+
43714380
| _ -> failwith "Unexpected symbol type"
43724381

43734382
let tupledFunction = allSymbolUses |> findByDisplayName "tupleFunction"
43744383
match tupledFunction.Symbol with
43754384
| :? FSharpMemberOrFunctionOrValue as mfv ->
4385+
43764386
let curriedParamGroups =
43774387
mfv.CurriedParameterGroups
43784388
|> Seq.map Seq.toList
43794389
|> Seq.toList
4390+
4391+
//check the parameters
43804392
match curriedParamGroups with
43814393
| [[param1;param2;param3]] ->
4382-
param1.Type.TypeDefinition.DisplayName |> should equal "int"
4383-
param2.Type.TypeDefinition.DisplayName |> should equal "float"
4384-
param3.Type.TypeDefinition.DisplayName |> should equal "string"
4394+
param1.Type.TypeDefinition.DisplayName |> shouldEqual "int"
4395+
param2.Type.TypeDefinition.DisplayName |> shouldEqual "float"
4396+
param3.Type.TypeDefinition.DisplayName |> shouldEqual "string"
43854397
| _ -> failwith "Unexpected parameters"
4398+
4399+
//now check the return type
4400+
let retTyp = mfv.ReturnParameter
4401+
retTyp.Type.TypeDefinition.DisplayName |> shouldEqual "float32"
4402+
43864403
| _ -> failwith "Unexpected symbol type"
43874404

0 commit comments

Comments
 (0)