@@ -95,7 +95,8 @@ fn test_head_tail_pattern() {
9595
9696 println ! ( "Output:\n {}" , state. output) ;
9797
98- let visible_lines: Vec < _ > = state. output
98+ let visible_lines: Vec < _ > = state
99+ . output
99100 . lines ( )
100101 . filter ( |l| !l. contains ( "items hidden" ) )
101102 . collect ( ) ;
@@ -154,7 +155,8 @@ fn test_nested_directory_budget() {
154155 let dir_content = extract_directory_content ( & state. output , dir) ;
155156 assert ! (
156157 !dir_content. is_empty( ) ,
157- "Directory {} should show some content" , dir
158+ "Directory {} should show some content" ,
159+ dir
158160 ) ;
159161 }
160162 }
@@ -193,13 +195,18 @@ fn test_real_project_structure() {
193195 let mut state = DisplayState :: new ( config. max_lines , & config) ;
194196 state. show_items ( & src_contents, "" ) ;
195197
196- println ! ( "\n Testing with max_lines = {}:\n {}" , max_lines, state. output) ;
198+ println ! (
199+ "\n Testing with max_lines = {}:\n {}" ,
200+ max_lines, state. output
201+ ) ;
197202
198203 // Verify line limit
199204 let line_count = state. output . lines ( ) . count ( ) ;
200205 assert ! (
201206 line_count <= max_lines,
202- "Output exceeded {} lines (got {})" , max_lines, line_count
207+ "Output exceeded {} lines (got {})" ,
208+ max_lines,
209+ line_count
203210 ) ;
204211
205212 // Verify content visibility
@@ -265,30 +272,42 @@ fn test_expanded_project_structure() {
265272
266273 // Test cases with expected content checks
267274 let test_cases = vec ! [
268- ( 5 , ExpectedContent {
269- should_show_src: false ,
270- should_show_src_contents: false ,
271- min_visible_items: 2 ,
272- should_show_head_tail: false ,
273- } ) ,
274- ( 10 , ExpectedContent {
275- should_show_src: true ,
276- should_show_src_contents: true ,
277- min_visible_items: 4 ,
278- should_show_head_tail: true ,
279- } ) ,
280- ( 15 , ExpectedContent {
281- should_show_src: true ,
282- should_show_src_contents: true ,
283- min_visible_items: 6 ,
284- should_show_head_tail: true ,
285- } ) ,
286- ( 20 , ExpectedContent {
287- should_show_src: true ,
288- should_show_src_contents: true ,
289- min_visible_items: 8 ,
290- should_show_head_tail: true ,
291- } ) ,
275+ (
276+ 5 ,
277+ ExpectedContent {
278+ should_show_src: false ,
279+ should_show_src_contents: false ,
280+ min_visible_items: 2 ,
281+ should_show_head_tail: false ,
282+ } ,
283+ ) ,
284+ (
285+ 10 ,
286+ ExpectedContent {
287+ should_show_src: true ,
288+ should_show_src_contents: true ,
289+ min_visible_items: 4 ,
290+ should_show_head_tail: true ,
291+ } ,
292+ ) ,
293+ (
294+ 15 ,
295+ ExpectedContent {
296+ should_show_src: true ,
297+ should_show_src_contents: true ,
298+ min_visible_items: 6 ,
299+ should_show_head_tail: true ,
300+ } ,
301+ ) ,
302+ (
303+ 20 ,
304+ ExpectedContent {
305+ should_show_src: true ,
306+ should_show_src_contents: true ,
307+ min_visible_items: 8 ,
308+ should_show_head_tail: true ,
309+ } ,
310+ ) ,
292311 ] ;
293312
294313 for ( max_lines, expected) in test_cases {
@@ -325,30 +344,38 @@ fn test_expanded_project_structure() {
325344 }
326345
327346 // Count visible items (non-hidden lines)
328- let visible_items = output. lines ( )
347+ let visible_items = output
348+ . lines ( )
329349 . filter ( |l| !l. contains ( "items hidden" ) )
330350 . count ( ) ;
331351
332352 println ! ( "Visible items: {}" , visible_items) ;
333353
334354 // Basic structure checks based on available space
335355 if expected. should_show_src {
336- assert ! ( output. contains( "src" ) , "Should show src directory with {} lines" , max_lines) ;
356+ assert ! (
357+ output. contains( "src" ) ,
358+ "Should show src directory with {} lines" ,
359+ max_lines
360+ ) ;
337361 }
338362
339363 if expected. should_show_src_contents {
340364 // For src directory
341365 assert ! (
342366 output. contains( "display" ) || output. contains( "main.rs" ) ,
343- "Should show some src directory contents with {} lines" , max_lines
367+ "Should show some src directory contents with {} lines" ,
368+ max_lines
344369 ) ;
345370
346371 // Verify head/tail pattern if expected
347372 if expected. should_show_head_tail {
348373 let src_section = output
349374 . lines ( )
350375 . skip_while ( |l| !l. contains ( "src" ) )
351- . take_while ( |l| l. starts_with ( "│ " ) || l. starts_with ( "├──" ) || l. starts_with ( "└──" ) )
376+ . take_while ( |l| {
377+ l. starts_with ( "│ " ) || l. starts_with ( "├──" ) || l. starts_with ( "└──" )
378+ } )
352379 . collect :: < Vec < _ > > ( )
353380 . join ( "\n " ) ;
354381
@@ -408,29 +435,20 @@ fn test_extended_head_tail_pattern() {
408435 println ! ( "Output:\n {}" , state. output) ;
409436
410437 let output = state. output ;
411-
438+
412439 println ! ( "\n Content analysis:" ) ;
413440 for line in output. lines ( ) {
414441 println ! ( "{}" , line) ;
415442 }
416443
417444 // Should show directory
418- assert ! (
419- output. contains( "src" ) ,
420- "Should show src directory"
421- ) ;
422-
445+ assert ! ( output. contains( "src" ) , "Should show src directory" ) ;
446+
423447 // Should show some files from beginning
424- assert ! (
425- output. contains( "file1.rs" ) ,
426- "Should show first file"
427- ) ;
448+ assert ! ( output. contains( "file1.rs" ) , "Should show first file" ) ;
428449
429450 // Should show hidden items indicator
430- assert ! (
431- output. contains( "items hidden" ) ,
432- "Should show hidden items"
433- ) ;
451+ assert ! ( output. contains( "items hidden" ) , "Should show hidden items" ) ;
434452
435453 // Line limit verification
436454 assert ! (
0 commit comments