Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcde3ab1

Browse files
antofikKevinRansom
authored andcommitted
Improved XmlDoc tests
1 parente8a8ef5 commitcde3ab1

File tree

3 files changed

+140
-51
lines changed

3 files changed

+140
-51
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
SOURCE=xmlDoc001.fs SCFLAGS="-r:System.Xml.dll --doc:xmlDoc001.xml --define:WITHXMLVERIFICATION"# xmlDoc001.fs
22
SOURCE=xmlDoc002.fs SCFLAGS="-r:System.Xml.dll --doc:xmlDoc002.xml --define:WITHXMLVERIFICATION"# xmlDoc002.fs
33
SOURCE=xmlDoc003.fs SCFLAGS="-r:System.Xml.dll --doc:xmlDoc003.xml --define:WITHXMLVERIFICATION"# xmlDoc003.fs
4-
SOURCE="xmlDoc004.fsx xmlDoc004.fs" SCFLAGS="-r:System.Xml.dll --doc:xmlDoc004.xml --define:WITHXMLVERIFICATION"# xmlDoc004.fs
4+
SOURCE=xmlDoc004.fs SCFLAGS="-r:System.Xml.dll --doc:xmlDoc004.xml --define:WITHXMLVERIFICATION"# xmlDoc004.fs
55
SOURCE=XMLDocOnEnum01.fs SCFLAGS="-r:System.Xml.dll --doc:XMLDocOnEnum01.xml --define:WITHXMLVERIFICATION"# XMLDocOnEnum01.fs
66

Lines changed: 139 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,153 @@
11
// #Regression #XMLDoc
2-
// This used to be regression test for FSHARP1.0:850
32
// Verify that XmlDoc name is correctly generated
43
//<Expects status=success></Expects>
54

65
#light
76

7+
namespaceMyRather.MyDeep.MyNamespace
88
openSystem.Xml
9-
openMyRather.MyDeep.MyNamespace
109

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")
16111

17112

18113
#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
29149
#else
30-
0
150+
0
31151
#endif
32152

33-
test|> exit
153+
test|> exit

‎tests/fsharpqa/Source/XmlDoc/Basic/xmlDoc004.fsx‎

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp