@@ -5,6 +5,7 @@ use regex::Regex;
5
5
6
6
pub mod assign;
7
7
pub mod close;
8
+ pub mod concern;
8
9
pub mod nominate;
9
10
pub mod note;
10
11
pub mod ping;
@@ -25,6 +26,7 @@ pub enum Command<'a> {
25
26
Shortcut ( Result < shortcut:: ShortcutCommand , Error < ' a > > ) ,
26
27
Close ( Result < close:: CloseCommand , Error < ' a > > ) ,
27
28
Note ( Result < note:: NoteCommand , Error < ' a > > ) ,
29
+ Concern ( Result < concern:: ConcernCommand , Error < ' a > > ) ,
28
30
Transfer ( Result < transfer:: TransferCommand , Error < ' a > > ) ,
29
31
}
30
32
@@ -97,6 +99,11 @@ impl<'a> Input<'a> {
97
99
Command :: Note ,
98
100
& original_tokenizer,
99
101
) ) ;
102
+ success. extend ( parse_single_command (
103
+ concern:: ConcernCommand :: parse,
104
+ Command :: Concern ,
105
+ & original_tokenizer,
106
+ ) ) ;
100
107
success. extend ( parse_single_command (
101
108
ping:: PingCommand :: parse,
102
109
Command :: Ping ,
@@ -206,6 +213,7 @@ impl<'a> Command<'a> {
206
213
Command :: Shortcut ( r) => r. is_ok ( ) ,
207
214
Command :: Close ( r) => r. is_ok ( ) ,
208
215
Command :: Note ( r) => r. is_ok ( ) ,
216
+ Command :: Concern ( r) => r. is_ok ( ) ,
209
217
Command :: Transfer ( r) => r. is_ok ( ) ,
210
218
}
211
219
}
@@ -353,3 +361,27 @@ fn review_ignored() {
353
361
assert_eq ! ( input. next( ) , None ) ;
354
362
}
355
363
}
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