File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -19,9 +19,9 @@ pub struct Package {
1919
2020impl Display for Package {
2121 fn fmt ( & self , f : & mut Formatter < ' _ > ) -> std:: fmt:: Result {
22- write ! ( f, "{}" , self . path[ 0 ] ) ?;
22+ write ! ( f, "{}" , self . path[ 0 ] . to_snake_case ( ) ) ?;
2323 for element in & self . path [ 1 ..self . path . len ( ) ] {
24- write ! ( f, ".{}" , element) ?;
24+ write ! ( f, ".{}" , element. to_snake_case ( ) ) ?;
2525 }
2626 Ok ( ( ) )
2727 }
@@ -291,4 +291,12 @@ mod tests {
291291 assert_eq ! ( t. prefix_match( ".foo.bar.Baz.Bar" ) , Some ( 4 ) ) ;
292292 assert_eq ! ( t. prefix_match( ".foo.bar.Baz.Bar.Boo" ) , None ) ;
293293 }
294+
295+ #[ test]
296+ fn test_handle_camel_case_in_package ( ) {
297+ assert_eq ! (
298+ Package :: new( "fooBar.baz.boo" ) . to_string( ) ,
299+ String :: from( "foo_bar.baz.boo" )
300+ )
301+ }
294302}
You can’t perform that action at this time.
0 commit comments