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

Commit6739420

Browse files
ReedCopseylatkin
ReedCopsey
authored andcommitted
Correct writeXmlDoc.addMembers
fixesdotnet#148closesdotnet#184commit a43070e2e0ffb2e4630e4e1e52632aad24d58801Merge:5e24472be66b39Author: latkin <latkin@microsoft.com>Date: Mon Feb 2 15:40:44 2015 -0800 Merge branch 'xml-fix' ofhttps://github.com/ReedCopsey/visualfsharp into ReedCopsey-xml-fixcommitbe66b39Author: ReedCopsey <reed@reedcopsey.com>Date: Mon Feb 2 10:47:51 2015 -0800 Corrected UnitOfMeasure XML Tests These previously required there to be an empty "member" variable for the indices to match. Adjusted indices to match new, correct generated XMLcommitfe1ef0dAuthor: ReedCopsey <reed@reedcopsey.com>Date: Fri Jan 30 17:32:28 2015 -0800 Added Basic\xmlDoc005.fs test To check that no empty members are generated.commit5450b68Author: ReedCopsey <reed@reedcopsey.com>Date: Fri Jan 30 13:58:43 2015 -0800 Correct writeXmlDoc.addMembers Prevent members from being added to the global member list when the xmlDoc contains no content.
1 parent5e24472 commit6739420

File tree

5 files changed

+84
-17
lines changed

5 files changed

+84
-17
lines changed

‎src/fsharp/fsc.fs‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -648,8 +648,9 @@ module XmlDocWriter =
648648
(* the xmlDocSigOf* functions encode type into string to be used in "id"*)
649649
letmembers= ref[]
650650
letaddMember id xmlDoc=
651-
letdoc= getDoc xmlDoc
652-
members:=(id,doc)::!members
651+
if hasDoc xmlDocthen
652+
letdoc= getDoc xmlDoc
653+
members:=(id,doc)::!members
653654
letdoVal(v:Val)= addMember v.XmlDocSig v.XmlDoc
654655
letdoUnionCase(uc:UnionCase)= addMember uc.XmlDocSig uc.XmlDoc
655656
letdoField(rf:RecdField)= addMember rf.XmlDocSig rf.XmlDoc

‎tests/fsharpqa/Source/XmlDoc/Basic/env.lst‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
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
44
SOURCE=xmlDoc004.fs SCFLAGS="-r:System.Xml.dll --doc:xmlDoc004.xml --define:WITHXMLVERIFICATION"# xmlDoc004.fs
5+
SOURCE=xmlDoc005.fs SCFLAGS="-r:System.Xml.dll --doc:xmlDoc005.xml --define:WITHXMLVERIFICATION"# xmlDoc005.fs
56
SOURCE=XMLDocOnEnum01.fs SCFLAGS="-r:System.Xml.dll --doc:XMLDocOnEnum01.xml --define:WITHXMLVERIFICATION"# XMLDocOnEnum01.fs
67

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// #Regression #XMLDoc
2+
// Verify that XmlDoc names are generated, but no empty members are generated re: issue #148
3+
//<Expects status=success></Expects>
4+
5+
#light
6+
7+
namespaceMyRather.MyDeep.MyNamespace
8+
openSystem.Xml
9+
10+
/// class1
11+
typeClass1()=
12+
/// x
13+
memberthis.X="X"
14+
15+
typeClass2()=
16+
memberthis.Y="Y"
17+
18+
///testModule
19+
moduleMyModule=
20+
21+
letcheck(xml:XmlDocument)name xmlDoc=
22+
letfoundDoc=((xml.SelectSingleNode("/doc/members/member[@name='"+ name+"']")).SelectSingleNode"summary").InnerText.Trim()
23+
if xmlDoc<> foundDocthen
24+
printfn"%s: generated xmlDoc <%s> differs from excpected <%s>" name foundDoc xmlDoc
25+
xmlDoc= foundDoc
26+
27+
lethasEmptyMembers(xml:XmlDocument)=
28+
letnode= xml.SelectSingleNode("/doc/members/member[@name='']")
29+
if node<>nullthen
30+
printfn"Empty member name entries found."
31+
node<>null
32+
33+
lettest=
34+
letmyname= System.Reflection.Assembly.GetExecutingAssembly().Location
35+
letxmlname= System.IO.Path.ChangeExtension(myname,"xml")
36+
37+
38+
#if WITHXMLVERIFICATION
39+
letxml=new XmlDocument()
40+
xml.Load xmlname
41+
if check xml"P:MyRather.MyDeep.MyNamespace.Class1.X""x"
42+
&& check xml"T:MyRather.MyDeep.MyNamespace.Class1""class1"
43+
&&not(hasEmptyMembers xml)
44+
then0else1
45+
#else
46+
0
47+
#endif
48+
49+
test|> exit

‎tests/fsharpqa/Source/XmlDoc/UnitOfMeasure/UnitOfMeasure01.fs‎

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,24 @@ let test =
2121
xml.Load(xmlname)
2222

2323
leta1= xml.GetElementsByTagName("summary").Item(0).FirstChild.Value="This is B"
24-
ifnot a1then printfn"a1: expected: This is B"; exit1
24+
ifnot a1then
25+
printfn"a1: expected: This is B"
26+
exit1
2527

2628
leta2= xml.GetElementsByTagName("summary").Item(1).FirstChild.Value="This is A"
27-
ifnot a2then printfn"a2: expected: This is A"; exit1
28-
29-
leta3= xml.GetElementsByTagName("member").Item(1).Attributes.Item(0).Value="M:UnitOfMeasure01.B(System.Single)"
30-
ifnot a3then printfn"a3: expected: M:UnitOfMeasure01.B(System.Single)"; exit1
31-
32-
leta4= xml.GetElementsByTagName("member").Item(2).Attributes.Item(0).Value="M:UnitOfMeasure01.A(System.Double)"
33-
ifnot a4then printfn"a4: expected: M:UnitOfMeasure01.A(System.Double)"; exit1
29+
ifnot a2then
30+
printfn"a2: expected: This is A"
31+
exit1
32+
33+
leta3= xml.GetElementsByTagName("member").Item(0).Attributes.Item(0).Value="M:UnitOfMeasure01.B(System.Single)"
34+
ifnot a3then
35+
printfn"a3: expected: M:UnitOfMeasure01.B(System.Single)"
36+
exit1
37+
38+
leta4= xml.GetElementsByTagName("member").Item(1).Attributes.Item(0).Value="M:UnitOfMeasure01.A(System.Double)"
39+
ifnot a4then
40+
printfn"a4: expected: M:UnitOfMeasure01.A(System.Double)"
41+
exit1
3442
#endif
3543
0
3644

‎tests/fsharpqa/Source/XmlDoc/UnitOfMeasure/UnitOfMeasure02.fs‎

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,24 @@ let test =
2424
xml.Load(xmlname)
2525

2626
leta1= xml.GetElementsByTagName("summary").Item(0).FirstChild.Value="This is B"
27-
ifnot a1then printfn"a1: expected: This is B"; exit1
27+
ifnot a1then
28+
printfn"a1: expected: This is B"
29+
exit1
2830

2931
leta2= xml.GetElementsByTagName("summary").Item(1).FirstChild.Value="This is A"
30-
ifnot a2then printfn"a2: expected: This is A"; exit1
32+
ifnot a2then
33+
printfn"a2: expected: This is A"
34+
exit1
3135

32-
leta3= xml.GetElementsByTagName("member").Item(1).Attributes.Item(0).Value="M:UnitOfMeasure02.B(System.Int32,System.Int32)"
33-
ifnot a3then printfn"a3: expected: M:UnitOfMeasure02.B(System.Int32,System.Int32)"; exit1
34-
35-
leta4= xml.GetElementsByTagName("member").Item(2).Attributes.Item(0).Value="M:UnitOfMeasure02.A(System.Double)"
36-
ifnot a4then printfn"a4: expected: M:UnitOfMeasure02.A(System.Double)"; exit1
36+
leta3= xml.GetElementsByTagName("member").Item(0).Attributes.Item(0).Value="M:UnitOfMeasure02.B(System.Int32,System.Int32)"
37+
ifnot a3then
38+
printfn"a3: expected: M:UnitOfMeasure02.B(System.Int32,System.Int32)"
39+
exit1
40+
41+
leta4= xml.GetElementsByTagName("member").Item(1).Attributes.Item(0).Value="M:UnitOfMeasure02.A(System.Double)"
42+
ifnot a4then
43+
printfn"a4: expected: M:UnitOfMeasure02.A(System.Double)"
44+
exit1
3745
#endif
3846
0
3947

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp