@@ -376,6 +376,66 @@ import Testing
376376 }
377377
378378}
379+
380+ @Suite ( " Progress Manager File URL Properties " ) struct ProgressManagerFileURLTests {
381+
382+ func doSomething( subprogress: consuming Subprogress ) async {
383+ let manager = subprogress. start ( totalCount: 1 )
384+
385+ manager. withProperties { properties in
386+ properties. completedCount += 1
387+ properties. fileURL = URL ( string: " https://www.kittens.com " )
388+ }
389+
390+ #expect( manager. fractionCompleted == 1.0 )
391+ #expect( manager. summary ( of: ProgressManager . Properties. FileURL. self) == [ URL ( string: " https://www.kittens.com " ) ] )
392+ }
393+
394+ @Test func discreteManager( ) async throws {
395+ let manager = ProgressManager ( totalCount: 1 )
396+
397+ manager. withProperties { properties in
398+ properties. completedCount += 1
399+ properties. fileURL = URL ( string: " https://www.cats.com " )
400+ }
401+
402+ #expect( manager. fractionCompleted == 1.0 )
403+ #expect( manager. summary ( of: ProgressManager . Properties. FileURL. self) == [ URL ( string: " https://www.cats.com " ) ] )
404+ }
405+
406+ @Test func twoLevelManagerWithFinishedChild( ) async throws {
407+ let manager = ProgressManager ( totalCount: 2 )
408+
409+ manager. withProperties { properties in
410+ properties. completedCount = 1
411+ properties. fileURL = URL ( string: " https://www.cats.com " )
412+ }
413+
414+ await doSomething ( subprogress: manager. subprogress ( assigningCount: 1 ) )
415+
416+ #expect( manager. fractionCompleted == 1.0 )
417+ #expect( manager. summary ( of: ProgressManager . Properties. FileURL. self) == [ URL ( string: " https://www.cats.com " ) ] )
418+ }
419+
420+ @Test func twoLevelManagerWithUnfinishedChild( ) async throws {
421+ let manager = ProgressManager ( totalCount: 2 )
422+
423+ manager. withProperties { properties in
424+ properties. completedCount = 1
425+ properties. fileURL = URL ( string: " https://www.cats.com " )
426+ }
427+
428+ let childManager = manager. subprogress ( assigningCount: 1 ) . start ( totalCount: 2 )
429+
430+ childManager. withProperties { properties in
431+ properties. completedCount = 1
432+ properties. fileURL = URL ( string: " https://www.kittens.com " )
433+ }
434+
435+ #expect( manager. fractionCompleted == 0.75 )
436+ #expect( manager. summary ( of: ProgressManager . Properties. FileURL. self) == [ URL ( string: " https://www.cats.com " ) , URL ( string: " https://www.kittens.com " ) ] )
437+ }
438+ }
379439
380440extension ProgressManager . Properties {
381441
0 commit comments