Ejemplo n.º 1
0
        public void ContainsBreakingChanges_is_true_when_commit_message_contains_a_breaking_change_footer()
        {
            // ARRANGE
            var commitMessage = GetCommitMessage(footers: new[] { new CommitMessageFooter(CommitMessageFooterName.BreakingChange, "some breaking change") });

            // ACT
            var changelogEntry = ChangeLogEntry.FromCommitMessage(GetGitCommit(), commitMessage);

            // ASSERT
            Assert.True(changelogEntry.ContainsBreakingChanges);
        }
Ejemplo n.º 2
0
        public void ContainsBreakingChanges_is_true_when_commit_message_was_marked_as_breaking_change()
        {
            // ARRANGE
            var commitMessage = GetCommitMessage(isBreakingChange: true);

            // ACT
            var changelogEntry = ChangeLogEntry.FromCommitMessage(GetGitCommit(), commitMessage);

            // ASSERT
            Assert.True(changelogEntry.ContainsBreakingChanges);
        }
Ejemplo n.º 3
0
        public void Footers_does_not_return_breaking_changes_footers_01()
        {
            // ARRANGE
            var commitMessage = GetCommitMessage(footers: new[] { new CommitMessageFooter(CommitMessageFooterName.BreakingChange, "some breaking change") });

            // ACT
            var changelogEntry = ChangeLogEntry.FromCommitMessage(GetGitCommit(), commitMessage);

            // ASSERT
            Assert.Empty(changelogEntry.Footers);
        }
Ejemplo n.º 4
0
        public void BreakingChanges_returns_descriptions_of_breaking_changes()
        {
            // ARRANGE
            var commitMessage = GetCommitMessage(footers: new[] { new CommitMessageFooter(CommitMessageFooterName.BreakingChange, "some breaking change") });

            // ACT
            var changelogEntry = ChangeLogEntry.FromCommitMessage(GetGitCommit(), commitMessage);

            // ASSERT
            var description = Assert.Single(changelogEntry.BreakingChangeDescriptions);

            Assert.Equal("some breaking change", description);
        }
Ejemplo n.º 5
0
        public void Footers_does_not_return_breaking_changes_footers_02()
        {
            // ARRANGE
            var commitMessage = GetCommitMessage(footers: new[] { new CommitMessageFooter(new CommitMessageFooterName("some-footer"), "some breaking change") });

            // ACT
            var changelogEntry = ChangeLogEntry.FromCommitMessage(GetGitCommit(), commitMessage);

            // ASSERT
            var footer = Assert.Single(changelogEntry.Footers);

            Assert.Equal(new CommitMessageFooterName("some-footer"), footer.Name);
            Assert.Equal("some breaking change", footer.Value.Text);
        }
Ejemplo n.º 6
0
        private bool TryGetChangeLogEntry(GitCommit commit, [NotNullWhen(true)] out ChangeLogEntry?entry)
        {
            var strictMode = m_Configuration.Parser.Mode == ChangeLogConfiguration.ParserMode.Strict;

            try
            {
                var parsed = CommitMessageParser.Parse(commit.CommitMessage, strictMode);
                entry = ChangeLogEntry.FromCommitMessage(commit, parsed);
                return(true);
            }
            catch (ParserException)
            {
                m_Logger.LogDebug($"Ignoring commit '{commit.Id}' because the commit message could not be parsed.");
                entry = default;
                return(false);
            }
        }