diff --git a/packages/path_provider/path_provider_foundation/darwin/RunnerTests/RunnerTests.swift b/packages/path_provider/path_provider_foundation/darwin/RunnerTests/RunnerTests.swift index 608b7f05971c..56c0790e4151 100644 --- a/packages/path_provider/path_provider_foundation/darwin/RunnerTests/RunnerTests.swift +++ b/packages/path_provider/path_provider_foundation/darwin/RunnerTests/RunnerTests.swift @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import XCTest +import Testing @testable import path_provider_foundation @@ -12,79 +12,49 @@ import XCTest import FlutterMacOS #endif -class RunnerTests: XCTestCase { - func testGetTemporaryDirectory() throws { +struct RunnerTests { + @Test(arguments: [ + (DirectoryType.temp, FileManager.SearchPathDirectory.cachesDirectory), + (.applicationDocuments, .documentDirectory), + (.library, .libraryDirectory), + (.downloads, .downloadsDirectory), + ]) + func directoryPath( + directoryType: DirectoryType, + searchPathDirectory: FileManager.SearchPathDirectory + ) throws { let plugin = PathProviderPlugin() - let path = plugin.getDirectoryPath(type: .temp) - XCTAssertEqual( - path, + let path = try #require(plugin.getDirectoryPath(type: directoryType)) + let expected = try #require( NSSearchPathForDirectoriesInDomains( - FileManager.SearchPathDirectory.cachesDirectory, - FileManager.SearchPathDomainMask.userDomainMask, + searchPathDirectory, + .userDomainMask, true - ).first) + ).first + ) + #expect(path == expected) } - func testGetApplicationDocumentsDirectory() throws { + @Test func getApplicationSupportDirectory() throws { let plugin = PathProviderPlugin() - let path = plugin.getDirectoryPath(type: .applicationDocuments) - XCTAssertEqual( - path, + let path = try #require(plugin.getDirectoryPath(type: .applicationSupport)) + let base = try #require( NSSearchPathForDirectoriesInDomains( - FileManager.SearchPathDirectory.documentDirectory, - FileManager.SearchPathDomainMask.userDomainMask, + .applicationSupportDirectory, + .userDomainMask, true - ).first) - } + ).first + ) - func testGetApplicationSupportDirectory() throws { - let plugin = PathProviderPlugin() - let path = plugin.getDirectoryPath(type: .applicationSupport) #if os(iOS) // On iOS, the application support directory path should be just the system application // support path. - XCTAssertEqual( - path, - NSSearchPathForDirectoriesInDomains( - FileManager.SearchPathDirectory.applicationSupportDirectory, - FileManager.SearchPathDomainMask.userDomainMask, - true - ).first) + #expect(path == base) #else // On macOS, the application support directory path should be the system application // support path with an added subdirectory based on the app name. - XCTAssert( - path!.hasPrefix( - NSSearchPathForDirectoriesInDomains( - FileManager.SearchPathDirectory.applicationSupportDirectory, - FileManager.SearchPathDomainMask.userDomainMask, - true - ).first!)) - XCTAssert(path!.hasSuffix("Example")) + #expect(path.hasPrefix(base)) + #expect(path.hasSuffix("Example")) #endif } - - func testGetLibraryDirectory() throws { - let plugin = PathProviderPlugin() - let path = plugin.getDirectoryPath(type: .library) - XCTAssertEqual( - path, - NSSearchPathForDirectoriesInDomains( - FileManager.SearchPathDirectory.libraryDirectory, - FileManager.SearchPathDomainMask.userDomainMask, - true - ).first) - } - - func testGetDownloadsDirectory() throws { - let plugin = PathProviderPlugin() - let path = plugin.getDirectoryPath(type: .downloads) - XCTAssertEqual( - path, - NSSearchPathForDirectoriesInDomains( - FileManager.SearchPathDirectory.downloadsDirectory, - FileManager.SearchPathDomainMask.userDomainMask, - true - ).first) - } } diff --git a/packages/path_provider/path_provider_foundation/example/ios/Runner.xcodeproj/project.pbxproj b/packages/path_provider/path_provider_foundation/example/ios/Runner.xcodeproj/project.pbxproj index 16c8997bc44a..c379ca6f25e0 100644 --- a/packages/path_provider/path_provider_foundation/example/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/path_provider/path_provider_foundation/example/ios/Runner.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 54; + objectVersion = 60; objects = { /* Begin PBXBuildFile section */ @@ -244,7 +244,7 @@ ); mainGroup = 97C146E51CF9000F007C117D; packageReferences = ( - 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "FlutterGeneratedPluginSwiftPackage" */, + 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */, ); productRefGroup = 97C146EF1CF9000F007C117D /* Products */; projectDirPath = ""; @@ -485,7 +485,7 @@ MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = dev.flutter.plugins.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; }; name = Debug; @@ -500,7 +500,7 @@ MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = dev.flutter.plugins.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; }; name = Release; @@ -515,7 +515,7 @@ MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = dev.flutter.plugins.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; }; name = Profile; @@ -708,7 +708,7 @@ /* End XCConfigurationList section */ /* Begin XCLocalSwiftPackageReference section */ - 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "FlutterGeneratedPluginSwiftPackage" */ = { + 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */ = { isa = XCLocalSwiftPackageReference; relativePath = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; }; diff --git a/packages/path_provider/path_provider_foundation/example/macos/Runner.xcodeproj/project.pbxproj b/packages/path_provider/path_provider_foundation/example/macos/Runner.xcodeproj/project.pbxproj index 576813461b16..d9cbf28a22b2 100644 --- a/packages/path_provider/path_provider_foundation/example/macos/Runner.xcodeproj/project.pbxproj +++ b/packages/path_provider/path_provider_foundation/example/macos/Runner.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 54; + objectVersion = 60; objects = { /* Begin PBXAggregateTarget section */ @@ -27,7 +27,7 @@ 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; - 33EBD3AA26728EA70013E557 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33EBD3A926728EA70013E557 /* RunnerTests.swift */; }; + 33EBD3AA26728EA70013E557 /* ../../../darwin/RunnerTests/RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33EBD3A926728EA70013E557 /* ../../../darwin/RunnerTests/RunnerTests.swift */; }; 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */; }; FEE1C654F5DF2F210CC17B17 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BA0C143378C83246316BE4F7 /* Pods_RunnerTests.framework */; }; /* End PBXBuildFile section */ @@ -83,7 +83,7 @@ 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; 33EBD3A726728EA70013E557 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 33EBD3A926728EA70013E557 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ../../../darwin/RunnerTests/RunnerTests.swift; sourceTree = ""; }; + 33EBD3A926728EA70013E557 /* ../../../darwin/RunnerTests/RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ../../../darwin/RunnerTests/RunnerTests.swift; sourceTree = ""; }; 33EBD3AB26728EA70013E557 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 46139048DB9F59D473B61B5E /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; @@ -183,7 +183,7 @@ 33EBD3A826728EA70013E557 /* RunnerTests */ = { isa = PBXGroup; children = ( - 33EBD3A926728EA70013E557 /* RunnerTests.swift */, + 33EBD3A926728EA70013E557 /* ../../../darwin/RunnerTests/RunnerTests.swift */, 33EBD3AB26728EA70013E557 /* Info.plist */, ); path = RunnerTests; @@ -297,7 +297,7 @@ ); mainGroup = 33CC10E42044A3C60003C045; packageReferences = ( - 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "FlutterGeneratedPluginSwiftPackage" */, + 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */, ); productRefGroup = 33CC10EE2044A3C60003C045 /* Products */; projectDirPath = ""; @@ -429,7 +429,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 33EBD3AA26728EA70013E557 /* RunnerTests.swift in Sources */, + 33EBD3AA26728EA70013E557 /* ../../../darwin/RunnerTests/RunnerTests.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -714,7 +714,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = dev.flutter.plugins.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/path_provider_example.app/Contents/MacOS/path_provider_example"; }; name = Debug; @@ -733,7 +733,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = dev.flutter.plugins.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/path_provider_example.app/Contents/MacOS/path_provider_example"; }; name = Release; @@ -752,7 +752,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = dev.flutter.plugins.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/path_provider_example.app/Contents/MacOS/path_provider_example"; }; name = Profile; @@ -803,7 +803,7 @@ /* End XCConfigurationList section */ /* Begin XCLocalSwiftPackageReference section */ - 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "FlutterGeneratedPluginSwiftPackage" */ = { + 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */ = { isa = XCLocalSwiftPackageReference; relativePath = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; };