@@ -67,13 +67,24 @@ func Test_expandDefaultMergeMessage(t *testing.T) {
6767}
6868
6969func TestAddCommitMessageTailer (t * testing.T ) {
70+ // add tailer for empty message
7071 assert .Equal (t , "\n \n Test-tailer: TestValue" , AddCommitMessageTailer ("" , "Test-tailer" , "TestValue" ))
72+
73+ // add tailer for message without newlines
7174 assert .Equal (t , "title\n \n Test-tailer: TestValue" , AddCommitMessageTailer ("title" , "Test-tailer" , "TestValue" ))
75+ assert .Equal (t , "title\n \n not tailer: xxx\n \n Test-tailer: TestValue" , AddCommitMessageTailer ("title\n \n not tailer: xxx" , "Test-tailer" , "TestValue" ))
76+
77+ // add tailer for message with one EOL
7278 assert .Equal (t , "title\n \n Test-tailer: TestValue" , AddCommitMessageTailer ("title\n " , "Test-tailer" , "TestValue" ))
79+
80+ // add tailer for message with two EOLs
7381 assert .Equal (t , "title\n \n Test-tailer: TestValue" , AddCommitMessageTailer ("title\n \n " , "Test-tailer" , "TestValue" ))
82+
83+ // add tailer for message with existing tailer (won't duplicate)
7484 assert .Equal (t , "title\n \n Test-tailer: TestValue" , AddCommitMessageTailer ("title\n \n Test-tailer: TestValue" , "Test-tailer" , "TestValue" ))
7585 assert .Equal (t , "title\n \n Test-tailer: TestValue\n " , AddCommitMessageTailer ("title\n \n Test-tailer: TestValue\n " , "Test-tailer" , "TestValue" ))
7686
87+ // add tailer for message with existing tailer and different value (will append)
7788 assert .Equal (t , "title\n \n Test-tailer: v1\n Test-tailer: v2" , AddCommitMessageTailer ("title\n \n Test-tailer: v1" , "Test-tailer" , "v2" ))
7889 assert .Equal (t , "title\n \n Test-tailer: v1\n Test-tailer: v2" , AddCommitMessageTailer ("title\n \n Test-tailer: v1\n " , "Test-tailer" , "v2" ))
7990}
0 commit comments