Created
March 14, 2017 20:11
-
-
Save cocotton/2a154706d654033dff6ff622827d234a to your computer and use it in GitHub Desktop.
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
var testPRMessageTests = []struct { | |
message string | |
expected error | |
}{ | |
{"Merge pull request #4 in ABC/def from some_branch to master\n\nMerge comment\n\n* commit '1h2e09d3029370d92723'", nil}, | |
{"Merge pull request #4 in ABC/def from some_branch to master\n", %%%WHAT_COMES_HERE%%%}, | |
} | |
func TestTestPRMessage(t *testing.T) { | |
for _, test := range testPRMessageTests { | |
actual := testPRMessage(test.message) | |
if actual != test.expected { | |
t.Errorf("getPRMessage(%s) - expected: %s, actual: %s", test.message, test.expected, actual) | |
} | |
} | |
} |
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
func testPRMessage(gitMessage string) error { | |
//var err error | |
if len(strings.Split(gitMessage, "\n")) < 3 { | |
return errors.New("Malformated pull request. Cannot find merge comment.") | |
} | |
return nil | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment