From 0e3f3ad1e06950f563e8621d9e40e2235dffe679 Mon Sep 17 00:00:00 2001 From: Pavel Yaskevich Date: Tue, 8 Apr 2025 09:37:19 -0700 Subject: [PATCH] [Tests] NFC: Add a package loading test for `.defaultIsolation` setting Meant to be a part of https://github.com/swiftlang/swift-package-manager/pull/8301 --- .../PD_6_2_LoadingTests.swift | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 Tests/PackageLoadingTests/PD_6_2_LoadingTests.swift diff --git a/Tests/PackageLoadingTests/PD_6_2_LoadingTests.swift b/Tests/PackageLoadingTests/PD_6_2_LoadingTests.swift new file mode 100644 index 00000000000..6ede8361eea --- /dev/null +++ b/Tests/PackageLoadingTests/PD_6_2_LoadingTests.swift @@ -0,0 +1,56 @@ +//===----------------------------------------------------------------------===// +// +// This source file is part of the Swift open source project +// +// Copyright (c) 2023-2025 Apple Inc. and the Swift project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See http://swift.org/LICENSE.txt for license information +// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors +// +//===----------------------------------------------------------------------===// + +import _InternalTestSupport +import Basics +import PackageModel +import SourceControl +import XCTest + +final class PackageDescription6_2LoadingTests: PackageDescriptionLoadingTests { + override var toolsVersion: ToolsVersion { + .v6_2 + } + + func testDefaultIsolationPerTarget() async throws { + let content = """ + import PackageDescription + let package = Package( + name: "Foo", + defaultLocalization: "be", + products: [], + targets: [ + .target( + name: "Foo", + swiftSettings: [ + .defaultIsolation(nil) + ] + ), + .target( + name: "Bar", + swiftSettings: [ + .defaultIsolation(MainActor.self) + ] + ) + ] + ) + """ + + let observability = ObservabilitySystem.makeForTesting() + let (_, validationDiagnostics) = try await loadAndValidateManifest( + content, + observabilityScope: observability.topScope + ) + XCTAssertNoDiagnostics(validationDiagnostics) + XCTAssertNoDiagnostics(observability.diagnostics) + } +}