From a599a50532c6bec14a01fd34dcba322236751164 Mon Sep 17 00:00:00 2001 From: omochimetaru Date: Wed, 22 May 2024 22:06:55 +0900 Subject: [PATCH] remove AbsolutePath.exists --- Tests/CartonCommandTests/BundleCommandTests.swift | 4 +++- Tests/CartonCommandTests/Testable.swift | 4 ---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Tests/CartonCommandTests/BundleCommandTests.swift b/Tests/CartonCommandTests/BundleCommandTests.swift index 7b5a203..15358e3 100644 --- a/Tests/CartonCommandTests/BundleCommandTests.swift +++ b/Tests/CartonCommandTests/BundleCommandTests.swift @@ -22,6 +22,8 @@ import XCTest final class BundleCommandTests: XCTestCase { func testWithNoArguments() async throws { + let fs = localFileSystem + try await withFixture("EchoExecutable") { packageDirectory in let bundleDirectory = packageDirectory.appending(component: "Bundle") @@ -29,7 +31,7 @@ final class BundleCommandTests: XCTestCase { try result.checkNonZeroExit() // Confirm that the files are actually in the folder - XCTAssertTrue(bundleDirectory.exists, "The Bundle directory should exist") + XCTAssertTrue(fs.isDirectory(bundleDirectory), "The Bundle directory should exist") XCTAssertTrue(bundleDirectory.ls().contains("index.html"), "Bundle does not have index.html") XCTAssertFalse( (bundleDirectory.ls().filter { $0.contains("wasm") }).isEmpty, diff --git a/Tests/CartonCommandTests/Testable.swift b/Tests/CartonCommandTests/Testable.swift index 3e1a5a5..eeca8ec 100644 --- a/Tests/CartonCommandTests/Testable.swift +++ b/Tests/CartonCommandTests/Testable.swift @@ -58,10 +58,6 @@ func withFixture(_ name: String, _ body: (AbsolutePath) async throws -> Void) as } extension AbsolutePath { - var exists: Bool { - FileManager.default.fileExists(atPath: pathString) - } - func ls() -> [String] { guard let paths = try? FileManager.default.subpathsOfDirectory(atPath: pathString) else { return [] }