Skip to content

Commit

Permalink
Workaround Verify limitation with .config files
Browse files Browse the repository at this point in the history
  • Loading branch information
JanKrivanek committed Nov 11, 2022
1 parent fd264d2 commit 3ff162c
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>

<!-- To customize the asp.net core module uncomment and edit the following section.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<RootNamespace>vb-console</RootNamespace>
<RootNamespace>vb_console</RootNamespace>
<TargetFramework>%FRAMEWORK%</TargetFramework>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<RootNamespace>vb-console</RootNamespace>
<RootNamespace>vb_console</RootNamespace>
<TargetFramework>%FRAMEWORK%</TargetFramework>
</PropertyGroup>

Expand Down
9 changes: 8 additions & 1 deletion src/Tests/dotnet-new.Tests/CommonTemplatesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.RegularExpressions;
using FluentAssertions;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.Extensions.Logging;
using Microsoft.NET.TestFramework;
Expand Down Expand Up @@ -64,6 +64,13 @@ public async void AllCommonItemsCreate(string expectedTemplateName, string templ
})
);

// TODO: workaround for '.config' files until https://github.com/VerifyTests/EmptyFiles/pull/110 is merged and flown all the way here
// Untill then a stream comparison is used without scrubbing and normalizing BOM, newlines etc.
VerifierSettings.RegisterFileConverter(
"config",
(stream, _) => new(null, "txt", new StringBuilder(new StreamReader(stream).ReadToEnd()))
);

// globaljson is appending current sdk version. Due to the 'base' dotnet used to run test this version differs
// on dev and CI runs and possibly from the version within test host. Easiest is just to scrub it away
if (templateShortName.Equals("globaljson") && args == null)
Expand Down

0 comments on commit 3ff162c

Please sign in to comment.