Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Ward <matt.ward@microsoft.com>2019-01-08 16:56:15 +0300
committerMatt Ward <matt.ward@microsoft.com>2019-01-08 16:56:15 +0300
commitf4e9942dbebb0769442fb3c30861d5c3e6eaad06 (patch)
treeb9bb8ca0038a05aeb0a0a62d5c03d8055f1892b1
parent95a3ef3c698767b3890f9cc41c61447ab01c6253 (diff)
[Core.Tests] Add failing PathTree testsfile-watcher-ignoring-directories
PathTree seems to find incorrect parent paths if the directories have a common parent path. This results in directories not being monitored by the file watcher service.
-rw-r--r--main/tests/MonoDevelop.Core.Tests/MonoDevelop.FSW/PathTreeTests.cs49
1 files changed, 49 insertions, 0 deletions
diff --git a/main/tests/MonoDevelop.Core.Tests/MonoDevelop.FSW/PathTreeTests.cs b/main/tests/MonoDevelop.Core.Tests/MonoDevelop.FSW/PathTreeTests.cs
index 7595a1e0a0..49e5ba41d2 100644
--- a/main/tests/MonoDevelop.Core.Tests/MonoDevelop.FSW/PathTreeTests.cs
+++ b/main/tests/MonoDevelop.Core.Tests/MonoDevelop.FSW/PathTreeTests.cs
@@ -24,6 +24,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
+using System.Collections.Generic;
using System.IO;
using System.Linq;
using MonoDevelop.Core;
@@ -418,6 +419,54 @@ namespace MonoDevelop.FSW
Assert.AreEqual ("a", nodes [0].Segment);
}
+ /// <summary>
+ /// Parent 'lib' directory was being dropped since the PathTree considered it to be a child of the mmp directory.
+ /// </summary>
+ [Test]
+ public void NormalizeTwoDirectories_FirstIsChildOfSecondDirectoryAdded ()
+ {
+ var tree = new PathTree ();
+ var id1 = new object ();
+
+ tree.AddNode ("/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib/mmp", id1);
+ tree.AddNode ("/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib", id1);
+
+ var folders = tree.Normalize (10).Select (node => (FilePath)node.FullPath);
+ var set = new HashSet <FilePath> (folders);
+
+ Assert.IsTrue (set.Contains ("/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib"), "Set: " + string.Join ("\n", set));
+ }
+
+ /// <summary>
+ /// All /Library/Frameworks/Mono.framework/Versions/5.18.0/lib/mono/gac/System.* subdirectories are
+ /// being ignored. The PathTree considers them children of the gac/System directory.
+ /// </summary>
+ [Test]
+ public void NormalizeSeveralDirectories_CommonBaseDirectory ()
+ {
+ var tree = new PathTree ();
+ var id1 = new object ();
+
+ var paths = new string[] {
+ "/Library/Frameworks/Mono.framework/Versions/5.18.0/lib/mono/4.5",
+ "/Library/Frameworks/Mono.framework/Versions/5.18.0/lib/mono/gac/System/4.0.0.0__b77a5c561934e089",
+ "/Library/Frameworks/Mono.framework/Versions/5.18.0/lib/mono/gac/System.Core/4.0.0.0__b77a5c561934e089",
+ "/Library/Frameworks/Mono.framework/Versions/5.18.0/lib/mono/gac/System.Data/4.0.0.0__b77a5c561934e089",
+ "/Library/Frameworks/Mono.framework/Versions/5.18.0/lib/mono/gac/System.Xml/4.0.0.0__b77a5c561934e089"
+ };
+
+ foreach (var path in paths) {
+ tree.AddNode (path, id1);
+ }
+
+ var folders = tree.Normalize (10).Select (node => (FilePath)node.FullPath);
+ var set = new HashSet<FilePath> (folders);
+
+ foreach (var path in paths) {
+ Assert.IsTrue (set.Contains (path), "Set: " + string.Join ("\n", set));
+ }
+ }
+
[Test]
public void CreateTreeAndDestructItNodeByNode ()
{