@@ -13,7 +13,7 @@ pub struct ProjectFileBuilder<'a> {
1313}
1414
1515lazy_static ! {
16- static ref TEAM_REGEX : Regex = Regex :: new( r#"^(?:#|//) @team (.*)$"# ) . expect( "error compiling regular expression" ) ;
16+ static ref TEAM_REGEX : Regex = Regex :: new( r#"^(?:#|//) @team:? (.*)$"# ) . expect( "error compiling regular expression" ) ;
1717}
1818
1919impl < ' a > ProjectFileBuilder < ' a > {
@@ -73,3 +73,35 @@ pub(crate) fn build_project_file_without_cache(path: &PathBuf) -> ProjectFile {
7373
7474 ProjectFile { path : path. clone ( ) , owner }
7575}
76+
77+ #[ cfg( test) ]
78+ mod tests {
79+ use super :: * ;
80+
81+ #[ test]
82+ fn test_team_regex ( ) {
83+ let owner = TEAM_REGEX
84+ . captures ( "// @team Foo" )
85+ . and_then ( |cap| cap. get ( 1 ) )
86+ . map ( |m| m. as_str ( ) . to_string ( ) ) ;
87+ assert_eq ! ( owner, Some ( "Foo" . to_string( ) ) ) ;
88+
89+ let owner = TEAM_REGEX
90+ . captures ( "// @team Foo" )
91+ . and_then ( |cap| cap. get ( 1 ) )
92+ . map ( |m| m. as_str ( ) . to_string ( ) ) ;
93+ assert_eq ! ( owner, Some ( "Foo" . to_string( ) ) ) ;
94+
95+ let owner = TEAM_REGEX
96+ . captures ( "// @team: Foo" )
97+ . and_then ( |cap| cap. get ( 1 ) )
98+ . map ( |m| m. as_str ( ) . to_string ( ) ) ;
99+ assert_eq ! ( owner, Some ( "Foo" . to_string( ) ) ) ;
100+
101+ let owner = TEAM_REGEX
102+ . captures ( "# @team: Foo" )
103+ . and_then ( |cap| cap. get ( 1 ) )
104+ . map ( |m| m. as_str ( ) . to_string ( ) ) ;
105+ assert_eq ! ( owner, Some ( "Foo" . to_string( ) ) ) ;
106+ }
107+ }
0 commit comments