forked from dotnet/fsharp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
XmlDocTests - Units of Measure.fs
96 lines (74 loc) · 4 KB
/
XmlDocTests - Units of Measure.fs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
module FSharp.Compiler.Service.Tests.XmlDocTestsUnitsOfMeasure
open FSharp.Compiler.Service.Tests.XmlDocTests
open FSharp.Compiler.Service.Tests.Common
open FSharp.Test.Compiler
open Xunit
// TODO: 12517: https://github.com/dotnet/fsharp/issues/12517
// https://github.com/dotnet/fsharp/blob/6c6588730c4d650a354e5ea3d46fb4630d7bba01/tests/fsharpqa/Source/XmlDoc/UnitOfMeasure/UnitOfMeasure01.fs
[<Fact(Skip = "https://github.com/dotnet/fsharp/issues/12517")>]
let ``Regression test for Dev11:390683, 388264 - UnitOfMeasure01.fs``(): unit =
let parseResults, checkResults = getParseAndCheckResultsOfSignatureFile """
namespace Test
open Microsoft.FSharp.Data.UnitSystems.SI.UnitNames
/// <summary>This is A</summary>
/// <param name="p1">This is pA</param>
let A (pA : float<ampere>) = pA / 1.<ampere>
/// <summary>This is B</summary>
/// <param name="p1">This is pB</param>
let B (pB : single) = 1.f<ampere> * pB
"""
parseResults |> checkParsingErrors [||]
checkResults |> checkXmlSymbols [ Entity "Test.A", [|"<summary>This is A</summary>"|] ]
checkResults |> checkXmlSymbols [ Entity "Test.B", [|"<summary>This is B</summary>"|] ]
// Include checkresults for <param>
// https://github.com/dotnet/fsharp/blob/6c6588730c4d650a354e5ea3d46fb4630d7bba01/tests/fsharpqa/Source/XmlDoc/UnitOfMeasure/UnitOfMeasure02.fs
[<Fact(Skip = "https://github.com/dotnet/fsharp/issues/12517")>]
let ``Regression test for Dev11:390683, 388264 - UnitOfMeasure02.fs``(): unit =
let parseResults, checkResults = getParseAndCheckResultsOfSignatureFile """
// Similar to UnitOfMeasure01, but with 2 params
open Microsoft.FSharp.Data.UnitSystems.SI.UnitNames
/// <summary>This is A</summary>
/// <param name="pA">This is pA</param>
let A (pA : float<ampere/ohm>) = pA / 1.<ampere>
/// <summary>This is B</summary>
/// <param name="pB1">This is pB1</param>
/// <param name="pB2">This is pB2</param>
let B (pB1 : int<meter>, pB2 : int<meter^2>) = pB1 * pB2
"""
parseResults |> checkParsingErrors [||]
checkResults |> checkXmlSymbols [ Field "Test.DU.B", [|"<summary>This is B</summary>"|] ]
checkResults |> checkXmlSymbols [ Field "Test.DU.A", [|"<summary>This is A</summary>"|] ]
// Include checkresults for <param>
// https://github.com/dotnet/fsharp/blob/6c6588730c4d650a354e5ea3d46fb4630d7bba01/tests/fsharpqa/Source/XmlDoc/UnitOfMeasure/UnitOfMeasure03.fs
[<Fact(Skip = "https://github.com/dotnet/fsharp/issues/12517")>]
let ``Regression test for Dev11:390683, 388264 -- UnitOfMeasure03.fs``(): unit =
let parseResults, checkResults = getParseAndCheckResultsOfSignatureFile """
type T =
/// <summary>This is A</summary>
/// <param name="pA">This is pA</param>
member __.A (pA : float<ampere/ohm>) = pA / 1.<ampere>
/// <summary>This is B</summary>
/// <param name="pB1">This is pB1</param>
/// <param name="pB2">This is pB2</param>
static member B (pB1 : int<meter>, pB2 : int<meter^2>) = pB1 * pB2
"""
parseResults |> checkParsingErrors [||]
checkResults |> checkXmlSymbols [ Field "Test.DU.B", [|"<summary>This is B</summary>"|] ]
checkResults |> checkXmlSymbols [ Field "Test.DU.A", [|"<summary>This is A</summary>"|] ]
/// Need to verify xmldoc for parameters parameters
// https://github.com/dotnet/fsharp/blob/6c6588730c4d650a354e5ea3d46fb4630d7bba01/tests/fsharpqa/Source/XmlDoc/UnitOfMeasure/UnitOfMeasure04.fs
[<Fact>]
let ``Regression test for Dev11:390683, 388264 -- UnitOfMeasure04.fs``(): unit =
let parseResults, checkResults = getParseAndCheckResultsOfSignatureFile """
namespace UnitOfMeasure04
// Similar to UnitOfMeasure03, but with the UoM in a DU
open Microsoft.FSharp.Data.UnitSystems.SI.UnitNames
type DU =
///<summary>This is A</summary>
| A of float<ampere/ohm>
///<summary>This is B</summary>
| B of (int<meter> * int64<meter^2>)
"""
parseResults |> checkParsingErrors [||]
checkResults |> checkXmlSymbols [ Field "UnitOfMeasure04.DU.B", [|"<summary>This is B</summary>"|] ]
checkResults |> checkXmlSymbols [ Field "UnitOfMeasure04.DU.A", [|"<summary>This is A</summary>"|] ]