Repository: dotnet/roslyn
File: src/Compilers/Core/MSBuildTaskTests/VbcTests.cs (C#)

Code before:
            var vbc = new Vbc
            {
                Sources = MSBuildUtil.CreateTaskItems("/Program.vb"),
            };

            var responseFileContents = vbc.GenerateResponseFileContents();
            Assert.Contains("/./Program.vb", responseFileContents);
            Assert.DoesNotContain(" /Program.vb", responseFileContents);
        }

        [ConditionalFact(typeof(UnixLikeOnly)), WorkItem("https://github.com/dotnet/roslyn/issues/80865")]
        public void MultipleSourceFilesWithRootDirectoryOnUnix()
        {
            // Test multiple files where some are in root and some are not
            // Also test that /dir/file.vb is NOT transformed (has second '/')
            var vbc = new Vbc
            {
                Sources = MSBuildUtil.CreateTaskItems("/Program.vb", "src/Test.vb", "/App.vb", "/dir/File.vb"),
            };

            var responseFileContents = vbc.GenerateResponseFileContents();
            Assert.Contains("/./Program.vb", responseFileContents);
            Assert.Contains("/./App.vb", responseFileContents);
            Assert.Contains("src/Test.vb", responseFileContents);
            // /dir/File.vb should NOT be transformed (contains second '/')
            Assert.Contains("/dir/File.vb", responseFileContents);
            Assert.DoesNotContain("/./dir/File.vb", responseFileContents);
        }
    }
}


Review comment (suggestion):
The other test had a leading space for this assertion, it seems reasonable to have it here also.
```suggestion
            Assert.Contains(" /dir/File.vb", responseFileContents);
```

Code after:
            var vbc = new Vbc
            {
                Sources = MSBuildUtil.CreateTaskItems("/Program.vb"),
            };

            var responseFileContents = vbc.GenerateResponseFileContents();
            Assert.Contains("/./Program.vb", responseFileContents);
            Assert.DoesNotContain(" /Program.vb", responseFileContents);
        }

        [ConditionalFact(typeof(UnixLikeOnly)), WorkItem("https://github.com/dotnet/roslyn/issues/80865")]
        public void MultipleSourceFilesWithRootDirectoryOnUnix()
        {
            // Test multiple files where some are in root and some are not
            // Also test that /dir/file.vb is NOT transformed (has second '/')
            var vbc = new Vbc
            {
                Sources = MSBuildUtil.CreateTaskItems("/Program.vb", "src/Test.vb", "/App.vb", "/dir/File.vb"),
            };

            var responseFileContents = vbc.GenerateResponseFileContents();
            Assert.Contains("/./Program.vb", responseFileContents);
            Assert.Contains("/./App.vb", responseFileContents);
            Assert.Contains(" src/Test.vb", responseFileContents);
            // /dir/File.vb should NOT be transformed (contains second '/')
            Assert.Contains(" /dir/File.vb", responseFileContents);
            Assert.DoesNotContain("/./dir/File.vb", responseFileContents);
        }

        [ConditionalFact(typeof(WindowsOnly)), WorkItem("https://github.com/dotnet/roslyn/issues/80865")]
        public void SourceFilePathsOnWindows()
        {
            // On Windows, paths should not be transformed even if they start with "/"
            var vbc = new Vbc
            {
                Sources = MSBuildUtil.CreateTaskItems("test.vb", "/test.vb"),
            };

            var responseFileContents = vbc.GenerateResponseFileContents();
            Assert.Contains(" test.vb", responseFileContents);
            // On Windows, /test.vb should NOT be transformed
            Assert.Contains(" /test.vb", responseFileContents);
            Assert.DoesNotContain("/./test.vb", responseFileContents);
        }
    }
}