From 707061fb1c9765283af2b54a5306a5ae454123e1 Mon Sep 17 00:00:00 2001 From: Sam Deane Date: Wed, 11 Dec 2024 12:34:58 +0000 Subject: [PATCH] fixed nested test with explanatory comment --- Tests/SwiftFormatTests/Core/IgnoreFileTests.swift | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Tests/SwiftFormatTests/Core/IgnoreFileTests.swift b/Tests/SwiftFormatTests/Core/IgnoreFileTests.swift index 78b48dc6..f3ec07ea 100644 --- a/Tests/SwiftFormatTests/Core/IgnoreFileTests.swift +++ b/Tests/SwiftFormatTests/Core/IgnoreFileTests.swift @@ -118,9 +118,17 @@ final class IgnoreFileTests: XCTestCase { XCTAssertNotNil(try IgnoreFile(for: url.appending(path: "Source/Ignored/file.swift"))) let iterator = FileIterator(urls: [url], followSymlinks: false) let files = Array(iterator) - print(files) - XCTAssertEqual(files.count, 1) - XCTAssertEqual(files.first?.lastPathComponent, "file.swift") + + // note that the ignore file has no effect on the FileIterator here, + // because it is not in the root directory + // this is expected behavior, and a limitation of the current implementation + // of FileIterator, as it flattens subdirectories into a single list rather + // than recursing into them; however, the ignore file itself will still be + // picked up and obeyed when each source file is processed. + XCTAssertEqual(files.count, 2) + for file in files { + XCTAssertEqual(file.lastPathComponent, "file.swift") + } } }