2008-12-09 Atsushi Enomoto <atsushi@ximian.com>
authorAtsushi Eno <atsushieno@gmail.com>
Tue, 9 Dec 2008 08:12:07 +0000 (08:12 -0000)
committerAtsushi Eno <atsushieno@gmail.com>
Tue, 9 Dec 2008 08:12:07 +0000 (08:12 -0000)
* Iterator.cs : DescendantIterator.Clone() was not cloning current
  node in new code. Fixed bug #456103.

* XPathNavigatorTests.cs : added test fo bug #456103.

svn path=/trunk/mcs/; revision=121080

mcs/class/System.XML/System.Xml.XPath/ChangeLog
mcs/class/System.XML/System.Xml.XPath/Iterator.cs
mcs/class/System.XML/Test/System.Xml.XPath/ChangeLog
mcs/class/System.XML/Test/System.Xml.XPath/XPathNavigatorTests.cs

index 5c51f3e08a90226f05c2c2e6c6a603f21a8267e3..2b26dea015b0fe04ab56644033561748cf7c3f7d 100644 (file)
@@ -1,3 +1,8 @@
+2008-12-09  Atsushi Enomoto <atsushi@ximian.com>
+
+       * Iterator.cs : DescendantIterator.Clone() was not cloning current
+         node in new code. Fixed bug #456103.
+
 2008-10-08  Atsushi Enomoto <atsushi@ximian.com>
 
        * Expression.cs : fix WeakReference usage for such case that it
index 7fd1d86d223c0f9e5c627e4ac656a37724525b5e..b1c7f8d147ffd70c3c90b62dc02d4e9d81dbbe05 100644 (file)
@@ -543,7 +543,7 @@ namespace System.Xml.XPath
 
                public DescendantIterator (BaseIterator iter) : base (iter) {}
 
-               private DescendantIterator (DescendantIterator other) : base (other)
+               private DescendantIterator (DescendantIterator other) : base (other, true)
                {
                        _depth = other._depth;
                        _finished = other._finished;
index 831d4b3e07fdfb9d93a81e18321cda8c8101a0c2..a53e4a611b8e4a34858949b4037954fca228c966 100644 (file)
@@ -1,3 +1,7 @@
+2008-12-09  Atsushi Enomoto <atsushi@ximian.com>
+
+       * XPathNavigatorTests.cs : added test fo bug #456103.
+
 2008-10-02  Atsushi Enomoto <atsushi@ximian.com>
 
        * XPathNavigatorEvaluateTests.cs : corrected couple of misconception
index 0d3a0fa83ce47c3fae69baecb1d5d8cad02d5b1f..4dfe25a39c5307f8454c8a9a6b94c67acd8e3d29 100644 (file)
@@ -427,6 +427,22 @@ namespace MonoTests.System.Xml
                        AssertEquals ("#2", true, nav.Matches ("text()"));
                }
 
+               [Test]
+               public void Bug456103 ()
+               {
+                       XmlDocument doc = new XmlDocument ();
+                       doc.LoadXml ("<root><X/></root>");
+
+                       XPathNavigator nav = doc.DocumentElement.CreateNavigator ();
+                       // ".//*" does not reproduce the bug.
+                       var i = nav.Select ("descendant::*");
+
+                       // without this call to get_Count() the bug does not reproduce.
+                       AssertEquals ("#1", 1, i.Count);
+
+                       Assert ("#2", i.MoveNext ());
+               }
+
 #if NET_2_0
                [Test]
                public void ValueAsBoolean ()