diff --git a/Mono.TextTemplating.Tests/ProcessingTests.cs b/Mono.TextTemplating.Tests/ProcessingTests.cs index 1043f3e..7f34a24 100644 --- a/Mono.TextTemplating.Tests/ProcessingTests.cs +++ b/Mono.TextTemplating.Tests/ProcessingTests.cs @@ -28,6 +28,7 @@ using System.CodeDom.Compiler; using System.IO; using System.Linq; +using System.Reflection.Emit; using System.Threading.Tasks; using Xunit; @@ -117,6 +118,22 @@ public async Task SetLangVersionViaAdditionalArgsInProcess () } #endif + [Fact] + public async Task SetOutputExtension () + { + string inputContent = "<#@ output extension=\".cfg\" #>"; + string inputFile = "hello.tt"; + string outputName = "hello.txt"; + + // this reproduces the calls made by dotnet-t4 + var gen = new TemplateGenerator (); + var pt = gen.ParseTemplate (inputFile, inputContent); + TemplateSettings settings = TemplatingEngine.GetSettings (gen, pt); + (outputName, _) = await gen.ProcessTemplateAsync (pt, inputFile, inputContent, outputName, settings); + + Assert.Equal ("hello.cfg", outputName); + } + [Fact] public async Task ImportReferencesTest () { diff --git a/Mono.TextTemplating/Mono.TextTemplating/TemplateGenerator.cs b/Mono.TextTemplating/Mono.TextTemplating/TemplateGenerator.cs index b92273b..92a8666 100644 --- a/Mono.TextTemplating/Mono.TextTemplating/TemplateGenerator.cs +++ b/Mono.TextTemplating/Mono.TextTemplating/TemplateGenerator.cs @@ -268,7 +268,7 @@ public string PreprocessTemplate ( var outputContent = await Engine.ProcessTemplateAsync (pt, inputContent, settings, this, token).ConfigureAwait (false); - return (outputFileName, outputContent); + return (OutputFile, outputContent); } #region Virtual members