diff --git a/Tests/SwiftParserTest/AttributeTests.swift b/Tests/SwiftParserTest/AttributeTests.swift index 64e887ec564..90e1ff9e652 100644 --- a/Tests/SwiftParserTest/AttributeTests.swift +++ b/Tests/SwiftParserTest/AttributeTests.swift @@ -540,4 +540,9 @@ final class AttributeTests: XCTestCase { AssertParse("func takeRepeater(_ f: @MainActor @Sendable @escaping () -> Int) {}") AssertParse("takeRepesater { @MainActor @Sendable () -> Int in 0 }") } + + func testPackageAttribute() { + AssertParse(#"@_package(path: "../my-package") import A"#) + AssertParse(#"@_package(url: "https://example.com/package.git", from: "0.0.1") @_exported import A"#) + } } diff --git a/Tests/SwiftSyntaxBuilderTest/ImportTests.swift b/Tests/SwiftSyntaxBuilderTest/ImportTests.swift index eece28a4ecd..85b1b2c3174 100644 --- a/Tests/SwiftSyntaxBuilderTest/ImportTests.swift +++ b/Tests/SwiftSyntaxBuilderTest/ImportTests.swift @@ -26,4 +26,15 @@ final class ImportTests: XCTestCase { AssertBuildResult(importDecl, "␣import SwiftSyntax") } + + func testPackageAttribute() { + let builder = ImportDeclSyntax(""" + @_package(url: "https://github.com/apple/swift-log.git", "1.0.0"..<"2.0.0") + import Logging + """) + AssertBuildResult(builder, """ + @_package(url: "https://github.com/apple/swift-log.git", "1.0.0" ..< "2.0.0") + import Logging + """) + } }