File tree Expand file tree Collapse file tree 1 file changed +29
-16
lines changed
Expand file tree Collapse file tree 1 file changed +29
-16
lines changed Original file line number Diff line number Diff line change @@ -4569,30 +4569,43 @@ fn test_ls_hyperlink_dirs() {
45694569fn test_ls_hyperlink_recursive_dirs ( ) {
45704570 let scene = TestScenario :: new ( util_name ! ( ) ) ;
45714571 let at = & scene. fixtures ;
4572- at. mkdir ( "example" ) ;
4573- at. mkdir ( "example/a" ) ;
4572+ let path = at. root_dir_resolved ( ) ;
4573+ let separator = std:: path:: MAIN_SEPARATOR_STR ;
4574+
4575+ let dir_a = "a" ;
4576+ let dir_b = "b" ;
4577+ at. mkdir ( dir_a) ;
4578+ at. mkdir ( format ! ( "{dir_a}/{dir_b}" ) ) ;
45744579
45754580 let result = scene
45764581 . ucmd ( )
45774582 . arg ( "--hyperlink" )
45784583 . arg ( "--recursive" )
4579- . arg ( "example" )
4584+ . arg ( dir_a )
45804585 . succeeds ( ) ;
45814586
4587+ macro_rules! assert_hyperlink {
4588+ ( $line: expr, $expected: expr) => {
4589+ assert!( matches!( $line, Some ( l) if l. starts_with( "\x1b ]8;;file://" ) && l. ends_with( $expected) ) ) ;
4590+ } ;
4591+ }
4592+
45824593 let mut lines = result. stdout_str ( ) . lines ( ) ;
4583- assert ! ( & lines
4584- . next( )
4585- . unwrap( )
4586- . ends_with( "/example\u{7} example\u{1b} ]8;;\u{7} :" ) ) ;
4587- assert ! ( & lines
4588- . next( )
4589- . unwrap( )
4590- . ends_with( "/example/a\u{7} a\u{1b} ]8;;\u{7} " ) ) ;
4591- assert ! ( & lines. next( ) . unwrap( ) . is_empty( ) ) ;
4592- assert ! ( & lines
4593- . next( )
4594- . unwrap( )
4595- . ends_with( "/example/a\u{7} example/a\u{1b} ]8;;\u{7} :" ) ) ;
4594+ assert_hyperlink ! (
4595+ lines. next( ) ,
4596+ & format!( "{path}{separator}{dir_a}\x07 {dir_a}\x1b ]8;;\x07 :" )
4597+ ) ;
4598+ assert_hyperlink ! (
4599+ lines. next( ) ,
4600+ & format!( "{path}{separator}{dir_a}{separator}{dir_b}\x07 {dir_b}\x1b ]8;;\x07 " )
4601+ ) ;
4602+ assert ! ( matches!( lines. next( ) , Some ( l) if l. is_empty( ) ) ) ;
4603+ assert_hyperlink ! (
4604+ lines. next( ) ,
4605+ & format!(
4606+ "{path}{separator}{dir_a}{separator}{dir_b}\x07 {dir_a}{separator}{dir_b}\x1b ]8;;\x07 :"
4607+ )
4608+ ) ;
45964609}
45974610
45984611#[ test]
You can’t perform that action at this time.
0 commit comments