コード例 #1
0
    public void ShouldUseFullHeaderAsSubjectIfNoTypeWasGivenButSubjectUsesColon()
    {
        var testCommit         = new TestCommit("c360d6a307909c6e571b29d4a329fd786c5d4543", "broadcast $destroy event: on scope destruction");
        var conventionalCommit = ConventionalCommitParser.Parse(testCommit);

        Assert.Equal(testCommit.Message, conventionalCommit.Subject);
    }
コード例 #2
0
    public void ShouldParseTypeScopeAndSubjectFromSingleLineCommitMessage()
    {
        var testCommit         = new TestCommit("c360d6a307909c6e571b29d4a329fd786c5d4543", "feat(scope): broadcast $destroy event on scope destruction");
        var conventionalCommit = ConventionalCommitParser.Parse(testCommit);

        Assert.Equal("feat", conventionalCommit.Type);
        Assert.Equal("scope", conventionalCommit.Scope);
        Assert.Equal("broadcast $destroy event on scope destruction", conventionalCommit.Subject);
    }
コード例 #3
0
    public void ShouldSupportExclamationMarkToSignifyingBreakingChanges(string commitMessage)
    {
        var testCommit         = new TestCommit("c360d6a307909c6e571b29d4a329fd786c5d4543", commitMessage);
        var conventionalCommit = ConventionalCommitParser.Parse(testCommit);

        conventionalCommit.Notes.ShouldHaveSingleItem();
        conventionalCommit.Notes[0].Title.ShouldBe("BREAKING CHANGE");
        conventionalCommit.Notes[0].Text.ShouldBe(string.Empty);
    }
コード例 #4
0
    public void ShouldExtractCommitNotes()
    {
        var testCommit         = new TestCommit("c360d6a307909c6e571b29d4a329fd786c5d4543", "feat(scope): broadcast $destroy: event on scope destruction\nBREAKING CHANGE: this will break rc1 compatibility");
        var conventionalCommit = ConventionalCommitParser.Parse(testCommit);

        Assert.Single(conventionalCommit.Notes);

        var breakingChangeNote = conventionalCommit.Notes.Single();

        Assert.Equal("BREAKING CHANGE", breakingChangeNote.Title);
        Assert.Equal("this will break rc1 compatibility", breakingChangeNote.Text);
    }