Skip to content

Commit

Permalink
Addresses PR comments
Browse files Browse the repository at this point in the history
Removes unneeded md file, and updates documentation
  • Loading branch information
mustiikhalil committed Mar 22, 2024
1 parent dbee90c commit 57141c6
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 51 deletions.
4 changes: 3 additions & 1 deletion Sources/SwiftDocC/Semantics/Metadata/Availability.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ extension Metadata {
///
/// `@Available` is analogous to the `@available` attribute in Swift: It allows you to specify a
/// platform version that the page relates to. To specify a platform and version, list the platform
/// name and use the `introduced` or `deprecated` arguments:
/// name and use the `introduced` argument. In addition, you can also specify a deprecated
/// version, using the `deprecated` argument:
///
/// ```markdown
/// @Available(macOS, introduced: "12.0")
/// @Available(macOS, introduced: "12.0", deprecated: "14.0")
/// ```
///
Expand Down
37 changes: 1 addition & 36 deletions Tests/SwiftDocCTests/Rendering/PlatformAvailabilityTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -107,41 +107,6 @@ class PlatformAvailabilityTests: XCTestCase {
}))
}

func testMultiplePlatformAvailabilityDeprecatedFromArticle() throws {
let (bundle, context) = try testBundleAndContext(named: "AvailabilityBundle")
let reference = ResolvedTopicReference(
bundleIdentifier: bundle.identifier,
path: "/documentation/AvailabilityBundle/ComplexAvailableDeprecated",
sourceLanguage: .swift
)
let article = try XCTUnwrap(context.entity(with: reference).semantic as? Article)
var translator = RenderNodeTranslator(
context: context,
bundle: bundle,
identifier: reference,
source: nil
)
let renderNode = try XCTUnwrap(translator.visitArticle(article) as? RenderNode)
let availability = try XCTUnwrap(renderNode.metadata.platformsVariants.defaultValue)
XCTAssertEqual(availability.count, 5)

XCTAssert(availability.contains(where: { item in
item.name == "iOS" && item.introduced == "11.0" && item.deprecated == "17.0"
}))
XCTAssert(availability.contains(where: { item in
item.name == "macOS" && item.introduced == "11.0" && item.deprecated == "14.0"
}))
XCTAssert(availability.contains(where: { item in
item.name == "watchOS" && item.deprecated == "7.0"
}))
XCTAssert(availability.contains(where: { item in
item.name == "MyPackage" && item.deprecated == "2.0"
}))
XCTAssert(availability.contains(where: { item in
item.name == "*" && item.deprecated == "2.0"
}))
}

func testArbitraryPlatformAvailability() throws {
let (bundle, context) = try testBundleAndContext(named: "AvailabilityBundle")
let reference = ResolvedTopicReference(
Expand All @@ -167,7 +132,7 @@ class PlatformAvailabilityTests: XCTestCase {
item.name == "My Package" && item.introduced == "2.0"
}))
}

// Test that the Info.plist default availability does not affect the deprecated/unavailable availabilities provided by the symbol graph.
func testAvailabilityParserWithInfoPlistDefaultAvailability() throws {
let (bundle, context) = try testBundleAndContext(named: "AvailabilityOverrideBundle")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ Here's a cool framework that I'm offering to the world.
### Cool Articles

- <doc:ComplexAvailable>
- <doc:ComplexAvailableDeprecated>
- <doc:ArbitraryPlatforms>

<!-- Copyright (c) 2022-2023 Apple Inc and the Swift Project authors. All Rights Reserved. -->

This file was deleted.

0 comments on commit 57141c6

Please sign in to comment.