@@ -137,7 +137,7 @@ async fn handle_rust_timer(
137
137
return Ok ( github:: Response ) ;
138
138
}
139
139
140
- for captures in build_captures ( & comment) . map ( |( _, captures) | captures) {
140
+ for captures in build_captures ( & comment. body ) . map ( |( _, captures) | captures) {
141
141
let include = captures. get ( 2 ) . map ( |v| v. as_str ( ) ) ;
142
142
let exclude = captures. get ( 3 ) . map ( |v| v. as_str ( ) ) ;
143
143
let runs = captures. get ( 4 ) . and_then ( |v| v. as_str ( ) . parse :: < i32 > ( ) . ok ( ) ) ;
@@ -152,17 +152,17 @@ async fn handle_rust_timer(
152
152
& main_client,
153
153
& ci_client,
154
154
issue. number ,
155
- build_captures ( & comment) . map ( |( commit, _) | commit) ,
155
+ build_captures ( & comment. body ) . map ( |( commit, _) | commit) ,
156
156
)
157
157
. await ?;
158
158
159
159
Ok ( github:: Response )
160
160
}
161
161
162
162
/// Run the `@rust-timer build` regex over the comment message extracting the commit and the other captures
163
- fn build_captures ( comment : & github :: Comment ) -> impl Iterator < Item = ( & str , regex:: Captures ) > {
163
+ fn build_captures ( comment_body : & str ) -> impl Iterator < Item = ( & str , regex:: Captures ) > {
164
164
BODY_TIMER_BUILD
165
- . captures_iter ( & comment . body )
165
+ . captures_iter ( & comment_body )
166
166
. filter_map ( |captures| {
167
167
captures. get ( 1 ) . map ( |m| {
168
168
let commit = m
@@ -188,3 +188,27 @@ pub async fn get_authorized_users() -> Result<Vec<usize>, String> {
188
188
. map_err ( |err| format ! ( "failed to fetch authorized users: {}" , err) )
189
189
. map ( |perms| perms. github_ids )
190
190
}
191
+
192
+ #[ cfg( test) ]
193
+ mod tests {
194
+ use super :: * ;
195
+ #[ test]
196
+ fn captures_all_shas ( ) {
197
+ let comment_body = r#"
198
+ Going to do perf runs for a few of these:
199
+
200
+ @rust-timer build 5832462aa1d9373b24ace96ad2c50b7a18af9952 (https://github.com/rust-lang/rust/pull/100307)
201
+ @rust-timer build 23936af287657fa4148aeab40cc2a780810fae52 (https://github.com/rust-lang/rust/pull/100392)
202
+ "# ;
203
+ let shas = build_captures ( comment_body)
204
+ . map ( |( c, _) | c)
205
+ . collect :: < Vec < _ > > ( ) ;
206
+ assert_eq ! (
207
+ shas,
208
+ & [
209
+ "5832462aa1d9373b24ace96ad2c50b7a18af9952" ,
210
+ "23936af287657fa4148aeab40cc2a780810fae52"
211
+ ]
212
+ ) ;
213
+ }
214
+ }
0 commit comments