Skip to content

Commit

Permalink
I don't like that .msg.g.cs thing
Browse files Browse the repository at this point in the history
  • Loading branch information
ltrzesniewski committed Jan 29, 2024
1 parent da966a7 commit 5875133
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void Should_generate_message_class_for_simple_dsl_file()

// Assert
var generatedSource = runResults.Results[0].GeneratedSources[0];
Assert.That(generatedSource.HintName, Is.EqualTo("Dsl_Messages.msg.g.cs"));
Assert.That(generatedSource.HintName, Is.EqualTo("Dsl_Messages.msg.cs"));
var sourceText = generatedSource.SourceText.ToString();
Assert.That(sourceText, Does.Contain("public sealed partial class DoSomethingCommand : ICommand"));
}
Expand All @@ -52,10 +52,10 @@ public void Should_generate_message_class_for_multiple_additional_files_with_con
.GetRunResult();

// Assert
var generatedSource1 = runResults.Results[0].GeneratedSources.Single(x => x.HintName == "Dsl_Messages1.msg.g.cs");
AssertMessageSourceIsCorrect(generatedSource1, "Dsl_Messages1.msg.g.cs", "public sealed partial class DoSomethingCommand : ICommand");
var generatedSource2 = runResults.Results[0].GeneratedSources.Single(x => x.HintName == "Dsl_Messages2.msg.g.cs");
AssertMessageSourceIsCorrect(generatedSource2, "Dsl_Messages2.msg.g.cs", "public sealed partial class DoSomethingCommand : ICommand");
var generatedSource1 = runResults.Results[0].GeneratedSources.Single(x => x.HintName == "Dsl_Messages1.msg.cs");
AssertMessageSourceIsCorrect(generatedSource1, "Dsl_Messages1.msg.cs", "public sealed partial class DoSomethingCommand : ICommand");
var generatedSource2 = runResults.Results[0].GeneratedSources.Single(x => x.HintName == "Dsl_Messages2.msg.cs");
AssertMessageSourceIsCorrect(generatedSource2, "Dsl_Messages2.msg.cs", "public sealed partial class DoSomethingCommand : ICommand");
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private static void GenerateOutput(SourceProductionContext context, SourceGenera
if (result.GeneratedSource is null)
return;

var hintName = _sanitizePathRegex.Replace(result.RelativePath ?? result.InputFile.Path, "_") + ".g.cs";
var hintName = _sanitizePathRegex.Replace(result.RelativePath ?? result.InputFile.Path, "_") + ".cs";
context.AddSource(hintName, result.GeneratedSource);
}

Expand Down

0 comments on commit 5875133

Please sign in to comment.