File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -200,7 +200,7 @@ fn validate_license_expr(s: &str) -> AppResult<()> {
200200
201201#[ cfg( test) ]
202202mod tests {
203- use super :: TopVersions ;
203+ use super :: { validate_license_expr , TopVersions } ;
204204 use chrono:: NaiveDateTime ;
205205
206206 #[ track_caller]
@@ -270,4 +270,20 @@ mod tests {
270270 }
271271 ) ;
272272 }
273+
274+ #[ test]
275+ fn licenses ( ) {
276+ assert_ok ! ( validate_license_expr( "MIT" ) ) ;
277+ assert_ok ! ( validate_license_expr( "MIT OR Apache-2.0" ) ) ;
278+ assert_ok ! ( validate_license_expr( "MIT/Apache-2.0" ) ) ;
279+ assert_ok ! ( validate_license_expr( "MIT AND Apache-2.0" ) ) ;
280+
281+ let error = assert_err ! ( validate_license_expr( "apache 2.0" ) ) ;
282+ let error = format ! ( "{}" , error) ;
283+ assert ! ( error. starts_with( "unknown license or other term: apache; see http" ) ) ;
284+
285+ let error = assert_err ! ( validate_license_expr( "MIT OR (Apache-2.0 AND MIT)" ) ) ;
286+ let error = format ! ( "{}" , error) ;
287+ assert ! ( error. starts_with( "unknown license or other term: (Apache-2.0; see http" ) ) ;
288+ }
273289}
You can’t perform that action at this time.
0 commit comments