[monodoc] Ditto for fetching type node parents of subnodes.
authorJérémie Laval <jeremie.laval@gmail.com>
Wed, 5 Jun 2013 23:41:07 +0000 (19:41 -0400)
committerJérémie Laval <jeremie.laval@gmail.com>
Wed, 5 Jun 2013 23:41:07 +0000 (19:41 -0400)
mcs/class/monodoc/Monodoc/providers/ecma-provider.cs
mcs/class/monodoc/Test/Monodoc/HelpSourceTests.cs

index 1cb79c87e946e8cee769f12433857a9b72664eef..53e54c4310bec6f0a4791fec6603e4be6597bc71 100644 (file)
@@ -274,7 +274,8 @@ namespace Monodoc.Providers
                Node GetNodeTypeParent (Node node)
                {
                        // Type nodes are always at level 2 so we just need to get there
-                       while (node != null && node.Parent != null && !node.Parent.Parent.Element.StartsWith ("root:/", StringComparison.OrdinalIgnoreCase))
+                       while (node != null && node.Parent != null
+                              && !node.Parent.Parent.Element.StartsWith ("root:/", StringComparison.OrdinalIgnoreCase) && node.Parent.Parent.Parent != null)
                                node = node.Parent;
                        return node;
                }
index 5816430c8d3b7a061d2d6ce6dbabd02a79e0aa67..867c9b793898dfb675e3aa05f15da5df70e6ec4c 100644 (file)
@@ -165,6 +165,10 @@ namespace MonoTests.Monodoc
                        var nsChildUrl = hs.Tree.RootNode.ChildNodes.First ().PublicUrl;
                        Assert.IsNotNull (nsChildUrl);
                        StringAssert.StartsWith ("N:", nsChildUrl);
+                       // Verify GetNodeTypeParent
+                       var typeNode = hs.Tree.RootNode.ChildNodes.First ().ChildNodes.First ();
+                       var metaNode = typeNode.ChildNodes.First (cn => cn.Element == "M");
+                       StringAssert.StartsWith (typeNode.PublicUrl, metaNode.PublicUrl);
                }
 
                /*