|
1 | 1 | // #Regression #XMLDoc |
2 | | -// This used to be regression test for FSHARP1.0:850 |
3 | 2 | // Verify that XmlDoc name is correctly generated |
4 | 3 | //<Expects status=success></Expects> |
5 | 4 |
|
6 | 5 | #light |
7 | 6 |
|
| 7 | +namespaceMyRather.MyDeep.MyNamespace |
8 | 8 | openSystem.Xml |
9 | | -openMyRather.MyDeep.MyNamespace |
10 | 9 |
|
11 | | -letcheck(xml:XmlDocument)name xmlDoc= |
12 | | - xmlDoc=((xml.SelectSingleNode("/doc/members/member[@name='"+ name+"']")).SelectSingleNode"summary").InnerText.Trim() |
13 | | -lettest= |
14 | | -letmyname= System.Reflection.Assembly.GetExecutingAssembly().Location |
15 | | -letxmlname= System.IO.Path.ChangeExtension(myname,"xml") |
| 10 | +///shape |
| 11 | +typeShape= |
| 12 | +| Rectangleofwidth:float*length:float |
| 13 | +///circle |
| 14 | +| Circleofradius:float |
| 15 | +| Prismofwidth:float*float*height:float |
| 16 | + |
| 17 | +///freeRecord |
| 18 | +typeEnum= |
| 19 | +///xxx |
| 20 | +| XXX=3 |
| 21 | +///zzz |
| 22 | +| ZZZ=11 |
| 23 | + |
| 24 | +///testModule |
| 25 | +moduleMyModule= |
| 26 | +///testRecord |
| 27 | +typeTestRecord={ |
| 28 | +/// Record string |
| 29 | + MyProperpty:string |
| 30 | +} |
| 31 | + |
| 32 | +///point3D |
| 33 | +typePoint3D= |
| 34 | +struct |
| 35 | +///point.x |
| 36 | +valx:float |
| 37 | +///point.y |
| 38 | +valy:float |
| 39 | +valz:float |
| 40 | +end |
| 41 | + |
| 42 | +///test enum |
| 43 | +typeTestEnum= |
| 44 | +///enumValue1 |
| 45 | +| VALUE1=1 |
| 46 | +///enumValue2 |
| 47 | +| VALUE2=2 |
| 48 | + |
| 49 | +///test union |
| 50 | +typeTestUnion= |
| 51 | +///union - enum |
| 52 | +| TestEnum |
| 53 | +///union - record |
| 54 | +| TestRecord |
| 55 | + |
| 56 | +///testClass |
| 57 | +typeMyGenericClass<'a>(x: 'a)= |
| 58 | +///testClass value |
| 59 | +letdata= x |
| 60 | + |
| 61 | +do printfn"%A" x |
| 62 | +///testClass member |
| 63 | +memberthis.TestMethod()= |
| 64 | + printfn"test method" |
| 65 | + |
| 66 | +///nested module |
| 67 | +moduleMyNestedModule= |
| 68 | +///testRecord nested |
| 69 | +typeTestRecord={ |
| 70 | +/// Record string nested |
| 71 | + MyProperpty:string |
| 72 | +} |
| 73 | + |
| 74 | +///test enum nested |
| 75 | +typeTestEnum= |
| 76 | +///enumValue1 nested |
| 77 | +| VALUE1=1 |
| 78 | +///enumValue2 nested |
| 79 | +| VALUE2=2 |
| 80 | + |
| 81 | +///test union nested |
| 82 | +typeTestUnion= |
| 83 | +///union - enum nested |
| 84 | +| TestEnum |
| 85 | +///union - record nested |
| 86 | +| TestRecord |
| 87 | + |
| 88 | +///testClass nested |
| 89 | +typeMyGenericClass<'a>(x: 'a)= |
| 90 | +///testClass value nested |
| 91 | +let mutabledata= x |
| 92 | + |
| 93 | +do printfn"%A" x |
| 94 | +///testClass member nested |
| 95 | +memberthis.TestMethod()= |
| 96 | + printfn"test method" |
| 97 | +/// A read-write property. |
| 98 | +memberthis.MyReadWriteProperty |
| 99 | +with get()= data |
| 100 | +andset(value)= data<- value |
| 101 | + |
| 102 | +letcheck(xml:XmlDocument)name xmlDoc= |
| 103 | +letfoundDoc=((xml.SelectSingleNode("/doc/members/member[@name='"+ name+"']")).SelectSingleNode"summary").InnerText.Trim() |
| 104 | +if xmlDoc<> foundDocthen |
| 105 | + printfn"%s: generated xmlDoc <%s> differs from excpected <%s>" name foundDoc xmlDoc |
| 106 | + xmlDoc= foundDoc |
| 107 | + |
| 108 | +lettest= |
| 109 | +letmyname= System.Reflection.Assembly.GetExecutingAssembly().Location |
| 110 | +letxmlname= System.IO.Path.ChangeExtension(myname,"xml") |
16 | 111 |
|
17 | 112 |
|
18 | 113 | #if WITHXMLVERIFICATION |
19 | | -letxml=new XmlDocument() |
20 | | - xml.Load xmlname |
21 | | -if check xml"T:MyRather.MyDeep.MyNamespace.TestEnum.VALUE2""enumValue2" |
22 | | -&& check xml"T:MyRather.MyDeep.MyNamespace.TestEnum""test enum" |
23 | | -&& check xml"F:MyRather.MyDeep.MyNamespace.TestRecord.MyProperpty""Record string" |
24 | | -&& check xml"T:MyRather.MyDeep.MyNamespace.TestRecord""testRecord" |
25 | | -&& check xml"M:MyRather.MyDeep.MyNamespace.myModule.testAnd(System.Boolean,System.Boolean)""my function" |
26 | | -&& check xml"P:MyRather.MyDeep.MyNamespace.myModule.myVariable""integer value" |
27 | | -&& check xml"T:MyRather.MyDeep.MyNamespace.myModule""my module comment" |
28 | | -then0else1 |
| 114 | +letxml=new XmlDocument() |
| 115 | + xml.Load xmlname |
| 116 | +if check xml"F:MyRather.MyDeep.MyNamespace.Enum.ZZZ""zzz" |
| 117 | +&& check xml"F:MyRather.MyDeep.MyNamespace.Enum.XXX""xxx" |
| 118 | +&& check xml"T:MyRather.MyDeep.MyNamespace.Enum""freeRecord" |
| 119 | +&& check xml"T:MyRather.MyDeep.MyNamespace.Shape.Circle""circle" |
| 120 | +&& check xml"T:MyRather.MyDeep.MyNamespace.Shape""shape" |
| 121 | +&& check xml"M:MyRather.MyDeep.MyNamespace.MyModule.MyGenericClass`1.TestMethod""testClass member" |
| 122 | +&& check xml"T:MyRather.MyDeep.MyNamespace.MyModule.MyGenericClass`1""testClass" |
| 123 | +&& check xml"T:MyRather.MyDeep.MyNamespace.MyModule.TestUnion.TestRecord""union - record" |
| 124 | +&& check xml"T:MyRather.MyDeep.MyNamespace.MyModule.TestUnion.TestEnum""union - enum" |
| 125 | +&& check xml"T:MyRather.MyDeep.MyNamespace.MyModule.TestUnion""test union" |
| 126 | +&& check xml"F:MyRather.MyDeep.MyNamespace.MyModule.TestEnum.VALUE2""enumValue2" |
| 127 | +&& check xml"F:MyRather.MyDeep.MyNamespace.MyModule.TestEnum.VALUE1""enumValue1" |
| 128 | +&& check xml"T:MyRather.MyDeep.MyNamespace.MyModule.TestEnum""test enum" |
| 129 | +&& check xml"F:MyRather.MyDeep.MyNamespace.MyModule.TestRecord.MyProperpty""Record string" |
| 130 | +&& check xml"T:MyRather.MyDeep.MyNamespace.MyModule.TestRecord""testRecord" |
| 131 | +&& check xml"M:MyRather.MyDeep.MyNamespace.MyModule.MyNestedModule.MyGenericClass`1.TestMethod""testClass member nested" |
| 132 | +&& check xml"T:MyRather.MyDeep.MyNamespace.MyModule.MyNestedModule.MyGenericClass`1""testClass nested" |
| 133 | +&& check xml"T:MyRather.MyDeep.MyNamespace.MyModule.MyNestedModule.TestUnion.TestRecord""union - record nested" |
| 134 | +&& check xml"T:MyRather.MyDeep.MyNamespace.MyModule.MyNestedModule.TestUnion.TestEnum""union - enum nested" |
| 135 | +&& check xml"T:MyRather.MyDeep.MyNamespace.MyModule.MyNestedModule.TestUnion""test union nested" |
| 136 | +&& check xml"F:MyRather.MyDeep.MyNamespace.MyModule.MyNestedModule.TestEnum.VALUE2""enumValue2 nested" |
| 137 | +&& check xml"F:MyRather.MyDeep.MyNamespace.MyModule.MyNestedModule.TestEnum.VALUE1""enumValue1 nested" |
| 138 | +&& check xml"T:MyRather.MyDeep.MyNamespace.MyModule.MyNestedModule.TestEnum""test enum nested" |
| 139 | +&& check xml"F:MyRather.MyDeep.MyNamespace.MyModule.MyNestedModule.TestRecord.MyProperpty""Record string nested" |
| 140 | +&& check xml"T:MyRather.MyDeep.MyNamespace.MyModule.MyNestedModule.TestRecord""testRecord nested" |
| 141 | +&& check xml"T:MyRather.MyDeep.MyNamespace.MyModule.MyNestedModule""nested module" |
| 142 | +&& check xml"T:MyRather.MyDeep.MyNamespace.MyModule""testModule" |
| 143 | +&& check xml"T:MyRather.MyDeep.MyNamespace.MyModule.Point3D""point3D" |
| 144 | +&& check xml"F:MyRather.MyDeep.MyNamespace.MyModule.Point3D.x""point.x" |
| 145 | +&& check xml"F:MyRather.MyDeep.MyNamespace.MyModule.Point3D.y""point.y" |
| 146 | +&& check xml"P:MyRather.MyDeep.MyNamespace.MyModule.MyNestedModule.MyGenericClass`1.MyReadWriteProperty(`0)""A read-write property." |
| 147 | +&& check xml"P:MyRather.MyDeep.MyNamespace.MyModule.MyNestedModule.MyGenericClass`1.MyReadWriteProperty""A read-write property." |
| 148 | +then0else1 |
29 | 149 | #else |
30 | | -0 |
| 150 | +0 |
31 | 151 | #endif |
32 | 152 |
|
33 | | -test|> exit |
| 153 | +test|> exit |