Skip to content

Commit

Permalink
ifed out embedded and swift 6 only test case
Browse files Browse the repository at this point in the history
  • Loading branch information
sliemeobn committed Dec 7, 2024
1 parent fe99cb9 commit 8e7246e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/Elementary/ServerSupport/SendOnceBox.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if swift(>=6.0)
#if swift(>=6.0) && !hasFeature(Embedded)
import Synchronization

@available(macOS 15.0, *)
Expand Down
2 changes: 2 additions & 0 deletions Sources/Elementary/ServerSupport/SendableAnyHTMLBox.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !hasFeature(Embedded)
/// A wrapper around an `any HTML` value that can be safely sent once.
///
/// Note: For non-sendable values, this will only allow the value to be taken only once.
Expand Down Expand Up @@ -42,3 +43,4 @@ public struct _SendableAnyHTMLBox: Sendable {
}
#endif
}
#endif
2 changes: 2 additions & 0 deletions Tests/ElementaryTests/SendableAnyHTMLBox.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ final class SendOnceHTMLValueTests: XCTestCase {
XCTAssertNotNil(box.tryTake())
}

#if swift(>=6.0)
func testHoldsNonSendable() {
let html = MyComponent()
let box = _SendableAnyHTMLBox(html)
XCTAssertNotNil(box.tryTake())
XCTAssertNil(box.tryTake())
}
#endif
}

class NonSendable {
Expand Down

0 comments on commit 8e7246e

Please sign in to comment.