-
Notifications
You must be signed in to change notification settings - Fork 120
Make Test.Attachment
generic.
#814
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
573a5c1
Make `Test.Attachment` generic.
grynspan a40bc31
Add accessors through withUnsafeBufferPointer since the type-erased a…
grynspan 7df01e9
Work around rdar://137614425 (again)
grynspan 2a10020
Work around a compiler crash (again, yes)
grynspan e71c2ad
Work around the compiler crash a second time
grynspan 5ef993d
Use a dedicated type to represent any attachable value rather than an…
grynspan 98c96a1
Nest AnyAttachable
grynspan e714477
Add AttachableContainer protocol for abstracting away box/adapter typ…
grynspan ffbe17a
Update comments, make AttachableContainer always Copyable & Sendable
grynspan 33bcb03
Actually no, make Test.AttachableContainer optionally copyable/sendab…
grynspan 6c90061
Enable SuppressedAssociatedTypes feature
grynspan 1e06f22
Move AttachableContainer to its own file
grynspan 77e5be4
Delete incorrect comment
grynspan ae8fc54
Hoist source location up to Event
grynspan ec9542d
Post issue events to the current configuration
grynspan 0967acc
Use the proxied withUnsafeBufferPointer call more
grynspan 064222d
Update doc comment for updated .valueAttached case
grynspan 8660c4d
Fix documentation links on Event.sourceLocation
grynspan 6bb2335
Correct comment
grynspan da4ea7c
Add SuppressedAssociatedTypes to CMake; remove buffer pointer conform…
grynspan 839766e
Remove generic parameter on ABIv0 structure
grynspan 5ed7039
Replace tabs with spaces
grynspan b9b9436
Move sourceLocation back to Attachment
grynspan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
Sources/Testing/Attachments/Test.AttachableContainer.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// | ||
// This source file is part of the Swift.org open source project | ||
// | ||
// Copyright (c) 2024 Apple Inc. and the Swift project authors | ||
// Licensed under Apache License v2.0 with Runtime Library Exception | ||
// | ||
// See https://swift.org/LICENSE.txt for license information | ||
// See https://swift.org/CONTRIBUTORS.txt for Swift project authors | ||
// | ||
|
||
@_spi(Experimental) | ||
extension Test { | ||
/// A protocol describing a type that can be attached to a test report or | ||
/// written to disk when a test is run and which contains another value that | ||
/// it stands in for. | ||
/// | ||
/// To attach an attachable value to a test report or test run output, use it | ||
/// to initialize a new instance of ``Test/Attachment``, then call | ||
/// ``Test/Attachment/attach(sourceLocation:)``. An attachment can only be | ||
/// attached once. | ||
/// | ||
/// A type can conform to this protocol if it represents another type that | ||
/// cannot directly conform to ``Test/Attachable``, such as a non-final class | ||
/// or a type declared in a third-party module. | ||
public protocol AttachableContainer<AttachableValue>: Attachable, ~Copyable { | ||
grynspan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
#if hasFeature(SuppressedAssociatedTypes) | ||
/// The type of the attachable value represented by this type. | ||
associatedtype AttachableValue: ~Copyable | ||
#else | ||
/// The type of the attachable value represented by this type. | ||
associatedtype AttachableValue | ||
#endif | ||
|
||
/// The attachable value represented by this instance. | ||
var attachableValue: AttachableValue { get } | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.