@@ -398,6 +398,45 @@ fn multiple_hardlinks_to_a_single_file() {
398398 . with_exclusive_shared_size ( file_size)
399399 . pipe ( Some ) ;
400400 assert_eq ! ( actual_shared_summary, expected_shared_summary) ;
401+
402+ let visualization = Command :: new ( PDU )
403+ . with_current_dir ( & workspace)
404+ . with_arg ( "--quantity=apparent-size" )
405+ . with_arg ( "--deduplicate-hardlinks" )
406+ . pipe ( stdio)
407+ . output ( )
408+ . expect ( "spawn command" )
409+ . pipe ( stdout_text) ;
410+
411+ eprintln ! ( "STDOUT:\n {visualization}" ) ;
412+
413+ let actual_hardlinks_summary = visualization
414+ . lines ( )
415+ . skip_while ( |line| !line. starts_with ( "Hardlinks detected!" ) )
416+ . join ( "\n " ) ;
417+ let expected_hardlinks_summary = {
418+ use parallel_disk_usage:: size:: Size ;
419+ use std:: fmt:: Write ;
420+ let mut summary = String :: new ( ) ;
421+ writeln ! (
422+ summary,
423+ "Hardlinks detected! No files have links outside this tree" ,
424+ )
425+ . unwrap ( ) ;
426+ writeln ! ( summary, "* Number of shared inodes: 1" ) . unwrap ( ) ;
427+ writeln ! ( summary, "* Total number of links: 11" ) . unwrap ( ) ;
428+ writeln ! (
429+ summary,
430+ "* Total shared size: {}" ,
431+ file_size. display( BytesFormat :: MetricUnits ) ,
432+ )
433+ . unwrap ( ) ;
434+ summary
435+ } ;
436+ assert_eq ! (
437+ actual_hardlinks_summary. trim_end( ) ,
438+ expected_hardlinks_summary. trim_end( ) ,
439+ ) ;
401440}
402441
403442#[ test]
0 commit comments