Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions test/dotnet.Tests/CommandTests/Run/RunFileTests_Directives.cs
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,7 @@ public static class Greeter
}
""");

// Duplicate #:ref directives are allowed (MSBuild can handle that).
File.WriteAllText(filePath, """
Comment thread
jjonescz marked this conversation as resolved.
#:ref lib.cs
#:ref lib.cs
Expand All @@ -581,16 +582,15 @@ public static class Greeter
new DotnetCommand(Log, "run", relativeFilePath)
.WithWorkingDirectory(testInstance.Path)
.Execute()
.Should().Fail()
.And.HaveStdErrContaining(DirectiveError(filePath, 2, FileBasedProgramsResources.DuplicateDirective, "#:ref lib.cs"));
.Should().Pass()
.And.HaveStdOut("Hello!");

File.WriteAllText(filePath, """
#:ref lib.cs
#:ref ./lib.cs
Console.WriteLine(MyLib.Greeter.Greet());
""");

// https://github.com/dotnet/sdk/issues/51139: we should detect the duplicate ref
new DotnetCommand(Log, "run", relativeFilePath)
.WithWorkingDirectory(testInstance.Path)
.Execute()
Expand All @@ -603,7 +603,6 @@ public static class Greeter
Console.WriteLine(MyLib.Greeter.Greet());
""");

// https://github.com/dotnet/sdk/issues/51139: we should detect the duplicate ref
new DotnetCommand(Log, "run", relativeFilePath)
.WithWorkingDirectory(testInstance.Path)
.Execute()
Expand Down
Loading