Skip to content

Commit

Permalink
workaround for dotnet#4988
Browse files Browse the repository at this point in the history
  • Loading branch information
vlada-shubina committed Jul 26, 2022
1 parent 3d98fbb commit 61badd8
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ foo
## comment bar
#bar
#endif
baz
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ foo
## comment bar
#bar
#endif
baz
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ foo
## comment bar
#bar
#endif
baz
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ foo
## comment bar
#bar
#endif
baz
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ foo
## comment bar
#bar
#endif
baz
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ foo
<!-- comment bar -- >
bar
#endif -->
baz
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ foo
// comment bar
bar
#endif
baz
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ foo
<!-- comment bar -- >
bar
#endif -->
baz
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ foo
## comment bar
#bar
#endif
baz
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ foo
## comment bar
#bar
#endif
baz
7 changes: 4 additions & 3 deletions test/dotnet-new3.UnitTests/DotnetNewInstantiate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ public void CanInstantiateTemplate_WithConditions_BasedOnFileName(string testCas
//## comment bar
//#bar
//#endif
//baz
//For extension test cases the template has 'test.<extension>' file defined.

Helpers.InstallTestTemplate("TemplateWithConditions", _log, home, workingDirectory);
Expand All @@ -288,7 +289,7 @@ public void CanInstantiateTemplate_WithConditions_BasedOnFileName(string testCas

string testFile = Path.Combine(workingDirectory, fileName);
Assert.True(File.Exists(testFile));
Assert.Equal($"{string.Format(expectedCommandFormat, "foo")}{expectedEol}foo{expectedEol}", File.ReadAllText(testFile));
Assert.Equal($"{string.Format(expectedCommandFormat, "foo")}{expectedEol}foo{expectedEol}baz{expectedEol}", File.ReadAllText(testFile));

workingDirectory = TestUtils.CreateTemporaryFolder();
new DotnetNewCommand(_log, "TestAssets.TemplateWithConditions", "--A", "false")
Expand All @@ -302,7 +303,7 @@ public void CanInstantiateTemplate_WithConditions_BasedOnFileName(string testCas

testFile = Path.Combine(workingDirectory, fileName);
Assert.True(File.Exists(testFile));
Assert.Equal($"", File.ReadAllText(testFile));
Assert.Equal($"baz{expectedEol}", File.ReadAllText(testFile));

workingDirectory = TestUtils.CreateTemporaryFolder();
new DotnetNewCommand(_log, "TestAssets.TemplateWithConditions", "--B", "true")
Expand All @@ -316,7 +317,7 @@ public void CanInstantiateTemplate_WithConditions_BasedOnFileName(string testCas

testFile = Path.Combine(workingDirectory, fileName);
Assert.True(File.Exists(testFile));
Assert.Equal($"{string.Format(expectedCommandFormat, "bar")}{expectedEol}bar{expectedEol}", File.ReadAllText(testFile));
Assert.Equal($"{string.Format(expectedCommandFormat, "bar")}{expectedEol}bar{expectedEol}baz{expectedEol}", File.ReadAllText(testFile));
}

[Fact]
Expand Down

0 comments on commit 61badd8

Please sign in to comment.