Skip to content

Commit

Permalink
fix(changelog): update of version summary
Browse files Browse the repository at this point in the history
  • Loading branch information
matkoch committed Aug 31, 2023
1 parent 527075c commit 419d23e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 41 deletions.
40 changes: 0 additions & 40 deletions source/Nuke.Common.Tests/ChangelogTasksTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,36 +22,6 @@ public class ChangelogTasksTest

private static AbsolutePath PathToChangelogReferenceFiles => RootDirectory / "source" / "Nuke.Common.Tests" / "ChangelogReferenceFiles";

[Theory]
[MemberData(nameof(AllChangelogReference_1_0_0_Files))]
[MemberData(nameof(AllChangelogReference_NUKE_Files))]
public void ReadReleaseNotes_ChangelogReferenceFile_ThrowsNoExceptions(AbsolutePath file)
{
Action act = () => ChangelogTasks.ReadReleaseNotes(file);

act.Should().NotThrow();
}

[Theory]
[MemberData(nameof(AllChangelogReference_1_0_0_Files))]
[MemberData(nameof(AllChangelogReference_NUKE_Files))]
public void ReadReleaseNotes_ChangelogReferenceFile_ReturnsAnyReleaseNotes(AbsolutePath file)
{
var releaseNotes = ChangelogTasks.ReadReleaseNotes(file);

releaseNotes.Should().NotBeEmpty();
}

[Theory]
[MemberData(nameof(AllChangelogReference_1_0_0_Files))]
[MemberData(nameof(AllChangelogReference_NUKE_Files))]
public void ReadChangelog_ChangelogReferenceFile_ThrowsNoExceptions(AbsolutePath file)
{
Action act = () => ChangelogTasks.ReadChangelog(file);

act.Should().NotThrow();
}

[Theory]
[MemberData(nameof(AllChangelogReference_1_0_0_Files))]
[MemberData(nameof(AllChangelogReference_NUKE_Files))]
Expand All @@ -62,16 +32,6 @@ public void ExtractChangelogSectionNotes_ChangelogReferenceFile_ThrowsNoExceptio
act.Should().NotThrow();
}

[Theory]
[MemberData(nameof(AllChangelogReference_1_0_0_Files))]
[MemberData(nameof(AllChangelogReference_NUKE_Files))]
public Task ReadReleaseNotes_ChangelogReferenceFile_HasParsedCorrectly(AbsolutePath file)
{
var releaseNotes = ChangelogTasks.ReadReleaseNotes(file);

return Verifier.Verify(releaseNotes).UseDirectory(PathToChangelogReferenceFiles).UseFileName(file.NameWithoutExtension);
}

[Fact]
public void GetReleaseSections_ChangelogReferenceFileWithoutReleaseHead_ReturnsEmpty()
{
Expand Down
8 changes: 7 additions & 1 deletion source/Nuke.Common/ChangeLog/ChangeLogTasks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,12 @@ internal static IEnumerable<ReleaseSection> GetReleaseSections(List<string> cont
static bool IsReleaseHead(string str)
=> str.StartsWith("## ");

static bool IsReleaseContent(string str)
=> str.StartsWith("###")
|| str.Trim().StartsWith("-")
|| str.Trim().StartsWith("*")
|| str.Trim().StartsWith("+");

static string GetCaption(string str)
=> str
.TrimStart('#', ' ', '[')
Expand All @@ -199,7 +205,7 @@ static string GetCaption(string str)
}

var caption = GetCaption(line);
var nextReleaseHeadIndex = content.FindIndex(index + 1, IsReleaseHead);
var nextReleaseHeadIndex = content.FindIndex(index + 1, x => IsReleaseHead(x) || !IsReleaseContent(x));

var releaseData =
new ReleaseSection
Expand Down

0 comments on commit 419d23e

Please sign in to comment.