diff options
author | vince <vincetiu8@gmail.com> | 2020-07-09 14:59:47 +0800 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2021-02-14 12:17:48 +0100 |
commit | d96284da646cc1d3e3d7d3b2f7a1ab0e8e7a4d88 (patch) | |
tree | 032869cd4c3ff959a42b7489795cc2cd8afc6423 /bug/comment_test.go | |
parent | 2788c5fc87507974d3237d4edc233fda3f784b35 (diff) | |
download | git-bug-d96284da646cc1d3e3d7d3b2f7a1ab0e8e7a4d88.tar.gz git-bug-d96284da646cc1d3e3d7d3b2f7a1ab0e8e7a4d88.zip |
Change the comment ID to use both bug and comment ID references.
Add comment edit command
This commit adds the comment edit command, which provides a CLI tool that allows a user to edit a comment.
Diffstat (limited to 'bug/comment_test.go')
-rw-r--r-- | bug/comment_test.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/bug/comment_test.go b/bug/comment_test.go new file mode 100644 index 00000000..423d10d8 --- /dev/null +++ b/bug/comment_test.go @@ -0,0 +1,27 @@ +package bug + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "github.com/MichaelMure/git-bug/entity" +) + +func TestCommentId(t *testing.T) { + bugId := entity.Id("abcdefghijklmnopqrstuvwxyz1234__________") + opId := entity.Id("ABCDEFGHIJ______________________________") + expectedId := entity.Id("aAbBcCdefDghijEklmnFopqrGstuvHwxyzI1234J") + + mergedId := DeriveCommentId(bugId, opId) + require.Equal(t, expectedId, mergedId) + + // full length + splitBugId, splitCommentId := SplitCommentId(mergedId.String()) + require.Equal(t, string(bugId[:30]), splitBugId) + require.Equal(t, string(opId[:10]), splitCommentId) + + splitBugId, splitCommentId = SplitCommentId(string(expectedId[:6])) + require.Equal(t, string(bugId[:3]), splitBugId) + require.Equal(t, string(opId[:3]), splitCommentId) +} |