@@ -5,6 +5,7 @@ use regex::Regex;
55
66pub mod assign;
77pub mod close;
8+ pub mod concern;
89pub mod nominate;
910pub mod note;
1011pub mod ping;
@@ -25,6 +26,7 @@ pub enum Command<'a> {
2526 Shortcut ( Result < shortcut:: ShortcutCommand , Error < ' a > > ) ,
2627 Close ( Result < close:: CloseCommand , Error < ' a > > ) ,
2728 Note ( Result < note:: NoteCommand , Error < ' a > > ) ,
29+ Concern ( Result < concern:: ConcernCommand , Error < ' a > > ) ,
2830 Transfer ( Result < transfer:: TransferCommand , Error < ' a > > ) ,
2931}
3032
@@ -97,6 +99,11 @@ impl<'a> Input<'a> {
9799 Command :: Note ,
98100 & original_tokenizer,
99101 ) ) ;
102+ success. extend ( parse_single_command (
103+ concern:: ConcernCommand :: parse,
104+ Command :: Concern ,
105+ & original_tokenizer,
106+ ) ) ;
100107 success. extend ( parse_single_command (
101108 ping:: PingCommand :: parse,
102109 Command :: Ping ,
@@ -206,6 +213,7 @@ impl<'a> Command<'a> {
206213 Command :: Shortcut ( r) => r. is_ok ( ) ,
207214 Command :: Close ( r) => r. is_ok ( ) ,
208215 Command :: Note ( r) => r. is_ok ( ) ,
216+ Command :: Concern ( r) => r. is_ok ( ) ,
209217 Command :: Transfer ( r) => r. is_ok ( ) ,
210218 }
211219 }
@@ -353,3 +361,27 @@ fn review_ignored() {
353361 assert_eq ! ( input. next( ) , None ) ;
354362 }
355363}
364+
365+ #[ test]
366+ fn concern ( ) {
367+ let input = "@bot concern this is my concern" ;
368+ let mut input = Input :: new ( input, vec ! [ "bot" ] ) ;
369+ assert_eq ! (
370+ input. next( ) ,
371+ Some ( Command :: Concern ( Ok ( concern:: ConcernCommand :: Concern {
372+ title: "this is my concern" . to_string( )
373+ } ) ) )
374+ ) ;
375+ }
376+
377+ #[ test]
378+ fn resolve ( ) {
379+ let input = "@bot resolve this is my concern" ;
380+ let mut input = Input :: new ( input, vec ! [ "bot" ] ) ;
381+ assert_eq ! (
382+ input. next( ) ,
383+ Some ( Command :: Concern ( Ok ( concern:: ConcernCommand :: Resolve {
384+ title: "this is my concern" . to_string( )
385+ } ) ) )
386+ ) ;
387+ }
0 commit comments