public void WildcardMultiSegmentDoesNotYieldPrefix() { var glob = new GlobParser().Parse("**"); var start = new GlobMatchFactory(true).Start(glob); var prefix = start.GetPrefixFilter(); Assert.That(prefix, Is.EqualTo("")); }
public void WildcardSegmentMatchesOnlyOnce() { var glob = new GlobParser().Parse("dir*ory"); var start = new GlobMatchFactory(true).Start(glob); var child = ApplyToHierarchy(start, "directory", "directory"); Assert.That(child.IsMatch, Is.False); Assert.That(child.CanContinue, Is.False); }
public void WildcardMultiSegmentCanMatchNoSegments() { var glob = new GlobParser().Parse("a/**/b"); var start = new GlobMatchFactory(true).Start(glob); var child = ApplyToHierarchy(start, "a", "b"); Assert.That(child.IsMatch, Is.True); Assert.That(child.CanContinue, Is.True); Assert.That(child.GetPathSegments().ToArray(), Is.EqualTo(new [] { "a", "b" })); }
public void WildcardMultiSegmentCanMatchMultipleDepths() { var glob = new GlobParser().Parse("a/**/b/**/c"); var start = new GlobMatchFactory(true).Start(glob); Assert.That(ApplyToHierarchy(start, "a", "b", "c").IsMatch, Is.True); Assert.That(ApplyToHierarchy(start, "a", "b", "c").GetPathSegments().ToArray(), Is.EqualTo(new [] { "a", "b", "c" })); Assert.That(ApplyToHierarchy(start, "a", "b", "c", "d").IsMatch, Is.False); Assert.That(ApplyToHierarchy(start, "a", "b", "c", "d", "c").IsMatch, Is.True); Assert.That(ApplyToHierarchy(start, "a", "b", "c", "d", "c").GetPathSegments().ToArray(), Is.EqualTo(new [] { "a", "b", "c", "d", "c" })); Assert.That(ApplyToHierarchy(start, "a", "c").IsMatch, Is.False); Assert.That(ApplyToHierarchy(start, "a", "d", "b", "c").IsMatch, Is.True); Assert.That(ApplyToHierarchy(start, "a", "d", "b", "c").GetPathSegments().ToArray(), Is.EqualTo(new [] { "a", "d", "b", "c" })); }