@@ -165,7 +165,6 @@ async fn handle_rust_timer(
165165fn parse_queue_command ( body : & str ) -> Option < Result < QueueCommand , String > > {
166166 let prefix = "@rust-timer" ;
167167 let bot_line = body. lines ( ) . find_map ( |line| {
168- let line = line. trim ( ) ;
169168 line. find ( prefix)
170169 . map ( |index| line[ index + prefix. len ( ) ..] . trim ( ) )
171170 } ) ?;
@@ -187,8 +186,11 @@ fn parse_queue_command(body: &str) -> Option<Result<QueueCommand, String>> {
187186 cmd. runs = Some ( runs as i32 ) ;
188187 }
189188
190- if let Some ( ( key, _) ) = args. into_iter ( ) . next ( ) {
191- return Some ( Err ( format ! ( "Unknown command argument {key}" ) ) ) ;
189+ if !args. is_empty ( ) {
190+ return Some ( Err ( format ! (
191+ "Unknown command argument(s) `{}`" ,
192+ args. into_keys( ) . collect:: <Vec <_>>( ) . join( "," )
193+ ) ) ) ;
192194 }
193195
194196 Some ( Ok ( cmd) )
@@ -295,7 +297,7 @@ Going to do perf runs for a few of these:
295297 #[ test]
296298 fn queue_command_unknown_arg ( ) {
297299 insta:: assert_compact_debug_snapshot!( parse_queue_command( "@rust-timer queue foo=bar" ) ,
298- @r###"Some(Err("Unknown command argument foo"))"### ) ;
300+ @r###"Some(Err("Unknown command argument(s) ` foo` "))"### ) ;
299301 }
300302
301303 #[ test]
@@ -351,4 +353,10 @@ Going to do perf runs for a few of these:
351353 insta:: assert_compact_debug_snapshot!( parse_queue_command( "@bors try @rust-timer queue include=foo,bar" ) ,
352354 @r###"Some(Ok(QueueCommand { include: Some("foo,bar"), exclude: None, runs: None }))"### ) ;
353355 }
356+
357+ #[ test]
358+ fn queue_command_parameter_order ( ) {
359+ insta:: assert_compact_debug_snapshot!( parse_queue_command( "@rust-timer queue runs=3 exclude=c,a include=b" ) ,
360+ @r###"Some(Ok(QueueCommand { include: Some("b"), exclude: Some("c,a"), runs: Some(3) }))"### ) ;
361+ }
354362}
0 commit comments