mirror of
https://github.com/unclebob/mutator.git
synced 2026-11-26 18:58:50 +00:00
Skip Swift test targets when choosing source files.
crapper treats Tests, AppTests, and *Tests.swift as tests, but mutator only asked is_test_file about the filename. That kept a file such as Tests/DemoTests/Board.swift, so a run would mutate the test suite. .build, .swiftpm, and DerivedData were already SKIP_DIRS. A Swift path is now a test path when a directory component ends with Tests, or the file name ends with Tests.swift. A deeper directory named test, the Java fixture layout, is still mutated. Proved by the source walk and by selecting Sources/Demo/Box.swift next to Tests/DemoTests/Board.swift and BoxTests.swift. The walk failed first because those three Tests paths were still chosen. Both tests pass. Co-authored-by: Robert C. Martin <[email protected]>
This commit is contained in:
co-authored by
Robert C. Martin
parent
b52159454d
commit
23b7d47936
@@ -48,6 +48,15 @@ CASES = {
|
||||
"src/pkg/foo.test.ts": False,
|
||||
"src/pkg/foo.spec.ts": False,
|
||||
"src/pkg/conftest.py": False,
|
||||
"Tests/DemoTests/Board.swift": False,
|
||||
"AppTests/Board.swift": False,
|
||||
"Sources/Demo/BoxTests.swift": False,
|
||||
"Sources/Demo/Box.swift": True,
|
||||
".build/debug/Generated.swift": False,
|
||||
".swiftpm/cache/Generated.swift": False,
|
||||
"DerivedData/App.swift": False,
|
||||
"src/pkg/Tests/Hidden.swift": False,
|
||||
"src/pkg/test/Kept.swift": True,
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user