Commit 7a936d9 1 parent f3ed6c4 commit 7a936d9 Copy full SHA for 7a936d9
File tree 2 files changed +28
-0
lines changed
2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -145,6 +145,7 @@ type CommentParseResult struct {
145
145
// - atlantis import ADDRESS ID
146
146
func (e * CommentParser ) Parse (rawComment string , vcsHost models.VCSHostType ) CommentParseResult {
147
147
comment := strings .TrimSpace (rawComment )
148
+ // comment = strings.Trim(comment, "`")
148
149
149
150
if multiLineRegex .MatchString (comment ) {
150
151
return CommentParseResult {Ignore : true }
Original file line number Diff line number Diff line change @@ -144,6 +144,33 @@ func TestParse_HelpResponse(t *testing.T) {
144
144
}
145
145
}
146
146
147
+ func TestParse_TrimCommandString (t * testing.T ) {
148
+ t .Log ("commands should be trimmed of whitespace and backtick (helps with Gitlab copy/paste issues)" )
149
+ allowCommandsCases := [][]command.Name {
150
+ command .AllCommentCommands ,
151
+ {}, // empty case
152
+ }
153
+ helpComments := []string {
154
+ "`atlantis help`" ,
155
+ "` atlantis help `" ,
156
+ "`atlantis help` " ,
157
+ " `atlantis help" ,
158
+ }
159
+ for _ , allowCommandCase := range allowCommandsCases {
160
+ for _ , c := range helpComments {
161
+ t .Run (fmt .Sprintf ("%s with allow commands %v" , c , allowCommandCase ), func (t * testing.T ) {
162
+ commentParser := events.CommentParser {
163
+ GithubUser : "github-user" ,
164
+ ExecutableName : "atlantis" ,
165
+ AllowCommands : allowCommandCase ,
166
+ }
167
+ r := commentParser .Parse (c , models .Github )
168
+ Equals (t , commentParser .HelpComment (), r .CommentResponse )
169
+ })
170
+ }
171
+ }
172
+ }
173
+
147
174
func TestParse_UnusedArguments (t * testing.T ) {
148
175
t .Log ("if there are unused flags we return an error" )
149
176
cases := []struct {
You can’t perform that action at this time.
0 commit comments