File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -119,6 +119,11 @@ pub fn uu_app() -> Command {
119119}
120120
121121fn basename ( fullname : & str , suffix : & str ) -> String {
122+ // Handle special case where path ends with /.
123+ if fullname. ends_with ( "/." ) {
124+ return "." . to_string ( ) ;
125+ }
126+
122127 // Convert to path buffer and get last path component
123128 let pb = PathBuf :: from ( fullname) ;
124129
Original file line number Diff line number Diff line change @@ -183,6 +183,13 @@ fn test_triple_slash() {
183183 new_ucmd ! ( ) . arg ( "///" ) . succeeds ( ) . stdout_is ( expected) ;
184184}
185185
186+ #[ test]
187+ fn test_trailing_dot ( ) {
188+ new_ucmd ! ( ) . arg ( "/." ) . succeeds ( ) . stdout_is ( ".\n " ) ;
189+ new_ucmd ! ( ) . arg ( "hello/." ) . succeeds ( ) . stdout_is ( ".\n " ) ;
190+ new_ucmd ! ( ) . arg ( "/foo/bar/." ) . succeeds ( ) . stdout_is ( ".\n " ) ;
191+ }
192+
186193#[ test]
187194fn test_simple_format ( ) {
188195 new_ucmd ! ( ) . args ( & [ "a-a" , "-a" ] ) . succeeds ( ) . stdout_is ( "a\n " ) ;
You can’t perform that action at this time.
0 commit comments