Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: correctly detect major version, for both angular style and basic…
… style - fixed BREAK_REGEX to work on multiline commits - added unit tests
- Loading branch information
1 parent
eb80522
commit 7385e19
Showing
3 changed files
with
72 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
from git_changelog.build import Commit | ||
from git_changelog.style import BasicStyle | ||
|
||
|
||
def test_basic_style_breaking_change(): | ||
subject = "Added a new breaking feature" | ||
body = ["BREAKING CHANGE: there is a breaking feature in this code"] | ||
commit = Commit(hash="aaaaaaa", subject=subject, body=body, author_date="1574340645", committer_date="1574340645") | ||
style = BasicStyle() | ||
commit_dict = style.parse_commit(commit) | ||
assert commit_dict["is_major"] | ||
assert not commit_dict["is_minor"] | ||
assert not commit_dict["is_patch"] | ||
|
||
|
||
def test_basic_style_breaking_changes(): | ||
subject = "Added a new breaking feature" | ||
body = ["BREAKING CHANGES: there is a breaking feature in this code"] | ||
commit = Commit(hash="aaaaaaa", subject=subject, body=body, author_date="1574340645", committer_date="1574340645") | ||
style = BasicStyle() | ||
commit_dict = style.parse_commit(commit) | ||
assert commit_dict["is_major"] | ||
assert not commit_dict["is_minor"] | ||
assert not commit_dict["is_patch"] | ||
|
||
|
||
def test_basic_style_feat(): | ||
subject = "Added a new feature" | ||
commit = Commit(hash="aaaaaaa", subject=subject, author_date="1574340645", committer_date="1574340645") | ||
style = BasicStyle() | ||
commit_dict = style.parse_commit(commit) | ||
assert not commit_dict["is_major"] | ||
assert commit_dict["is_minor"] | ||
assert not commit_dict["is_patch"] | ||
|
||
|
||
def test_basic_style_fix(): | ||
subject = "Fixed a bug" | ||
commit = Commit(hash="aaaaaaa", subject=subject, author_date="1574340645", committer_date="1574340645") | ||
style = BasicStyle() | ||
commit_dict = style.parse_commit(commit) | ||
assert not commit_dict["is_major"] | ||
assert not commit_dict["is_minor"] | ||
assert commit_dict["is_patch"] |