Repository: dotnet/runtime
File: src/libraries/Microsoft.Extensions.FileSystemGlobbing/tests/FunctionalTests.cs (C#)

Code before:

            PatternMatchingResult patternMatchingResult = matcher.Match(matchRoot,
                expectedSubPaths.Select(expectedSubPath => Path.Combine(filesRoot, expectedSubPath)));

            Assert.True(patternMatchingResult.HasMatches);
            Assert.Equal(expectedSubPaths.Length, patternMatchingResult.Files.Count());
        }

        [Theory]
        [InlineData(@"C:\this\example\root", @"C:\this\example\root", "**/*", new[] { "some/test/file.txt" })]
        public void VerifyFiles_InMemory_HasCaseSensitiveRootMatches(string matchRoot, string filesRoot, string pattern, string[] expectedSubPaths)
        {
            Matcher matcher = new(StringComparison.Ordinal);
            matcher.AddInclude(pattern);

            PatternMatchingResult patternMatchingResult = matcher.Match(matchRoot,
                expectedSubPaths.Select(expectedSubPath => Path.Combine(filesRoot, expectedSubPath)));

            Assert.True(patternMatchingResult.HasMatches);
            Assert.Equal(expectedSubPaths.Length, patternMatchingResult.Files.Count());
        }

        [Theory]
        [InlineData(@"C:\this\example\root", @"C:\this\EXAMPLE\root", "**/*", new[] { "some/test/file.txt" })]
        [InlineData(@"C:\this\EXAMPLE\root", @"C:\this\example\root", "**/*", new[] { "some/test/file.txt" })]
        public void VerifyFiles_InMemory_HasCaseSensitiveRootMisses(string matchRoot, string filesRoot, string pattern, string[] expectedSubPaths)
        {
            Matcher matcher = new(StringComparison.Ordinal);
            matcher.AddInclude(pattern);

            PatternMatchingResult patternMatchingResult = matcher.Match(matchRoot,
                expectedSubPaths.Select(expectedSubPath => Path.Combine(filesRoot, expectedSubPath)));

            Assert.False(patternMatchingResult.HasMatches);
            Assert.Equal(0, patternMatchingResult.Files.Count());
        }
    }
}


Review comment (bug):
This [failed in OSX](https://helixr1107v0xdeko0k025g8.blob.core.windows.net/dotnet-runtime-refs-pull-120159-merge-b8683405190747e0aa/Microsoft.Extensions.FileSystemGlobbing.Tests/1/console.18a53fcf.log?helixlogtype=result&skoid=8eda00af-b5ec-4be9-b69b-0919a2338892&sktid=72f988bf-86f1-41af-91ab-2d7cd011db47&skt=2025-09-26T22%3A05%3A29Z&ske=2025-09-26T23%3A05%3A29Z&sks=b&skv=2024-11-04&sv=2024-11-04&se=2025-09-26T23%3A05%3A29Z&sr=b&sp=rl&sig=07UFno4CUjHSkd2vby9cDU7nHEPToTIuuCw5t8IAolE%3D), can you please take a look.

InMemoryDirectoryInfo normalizes path in an [os dependant way](https://github.com/dotnet/dotnet/blob/2db1f5ee2bdda2e8d873769325fabede32e420e0/src/runtime/src/libraries/Microsoft.Extensions.FileSystemGlobbing/src/InMemoryDirectoryInfo.cs#L49) so C:\somepath is actually treated as /your/cwd/C:\somepath in Unix, I don't think that's the intent of this test.  You could use `/` instead of `C:\` and that should work the same for both Windows and Unix.

Code after:

            PatternMatchingResult patternMatchingResult = matcher.Match(matchRoot,
                expectedSubPaths.Select(expectedSubPath => Path.Combine(filesRoot, expectedSubPath)));

            Assert.True(patternMatchingResult.HasMatches);
            Assert.Equal(expectedSubPaths.Length, patternMatchingResult.Files.Count());
        }

        [Theory]
        [InlineData(@"/this/example/root", @"/this/example/root", "**/*", new[] { "some/test/file.txt" })]
        public void VerifyFiles_InMemory_HasCaseSensitiveRootMatches(string matchRoot, string filesRoot, string pattern, string[] expectedSubPaths)
        {
            Matcher matcher = new(StringComparison.Ordinal);
            matcher.AddInclude(pattern);

            PatternMatchingResult patternMatchingResult = matcher.Match(matchRoot,
                expectedSubPaths.Select(expectedSubPath => Path.Combine(filesRoot, expectedSubPath)));

            Assert.True(patternMatchingResult.HasMatches);
            Assert.Equal(expectedSubPaths.Length, patternMatchingResult.Files.Count());
        }

        [Theory]
        [InlineData(@"/this/example/root", @"/this/EXAMPLE/root", "**/*", new[] { "some/test/file.txt" })]
        [InlineData(@"/this/EXAMPLE/root", @"/this/example/root", "**/*", new[] { "some/test/file.txt" })]
        public void VerifyFiles_InMemory_HasCaseSensitiveRootMisses(string matchRoot, string filesRoot, string pattern, string[] expectedSubPaths)
        {
            Matcher matcher = new(StringComparison.Ordinal);
            matcher.AddInclude(pattern);

            PatternMatchingResult patternMatchingResult = matcher.Match(matchRoot,
                expectedSubPaths.Select(expectedSubPath => Path.Combine(filesRoot, expectedSubPath)));

            Assert.False(patternMatchingResult.HasMatches);
            Assert.Equal(0, patternMatchingResult.Files.Count());
        }
    }
}