Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: swiftlang/swift-testing
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 6.0.1
Choose a base ref
...
head repository: swiftlang/swift-testing
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref

Commits on Aug 21, 2024

  1. Fixes to exit tests. (#615)

    This PR supersedes #603, #613, and #614. Exit tests remain an
    experimental feature.
    
    ## Clarify that 8-bit exit codes aren't a problem on macOS and Windows.
    (#603)
    
    The documentation for the experimental exit tests feature currently says
    that on POSIX-like systems, only the low 8 bits of a process' exit code
    are preserved. This would be true if we used `wait()`, `wait4()`, etc.
    and `WEXITSTATUS()`, but we use `waitid()` instead which is [supposed
    to](https://pubs.opengroup.org/onlinepubs/9699919799/functions/exit.html)
    preserve the full exit code. It does so on Darwin, but not on Linux;
    Windows doesn't use `waitid()` but does report the full exit code.
    
    Now, we're not currently building for any other POSIX-like systems that
    support processes (WASI/Wasm doesn't count here), so I've left in some
    weasel words and added a canary unit test. It will let us know if/when
    we add a platform that where `waitid()` doesn't preserve all the bits of
    the exit code, and we can amend the documentation in that case.
    
     ## Implement an equality operator for ExitCondition. (#613)
    
    This PR implements `==` and `===` for `ExitCondition`, part of the
    experimental exit tests feature. These operators are necessary in order
    to allow for exit tests to support more complex matching by trailing
    closure (e.g. to support inspecting `stdout`.) Because `.failure` is a
    fuzzy case, `==` fuzzy-matches while `===` exactly matches. `Hashable`
    conformance is unavailable.
    
    Example usage:
    
    ```swift
    let lhs: ExitCondition = .failure
    let rhs: ExitCondition = .signal(SIGTERM)
    print(lhs == rhs) // prints "true"
    print(lhs === rhs) // prints "false"
    ```
    
     ## Allow throwing an error from an exit test's body. (#614)
    
    This PR amends the signatures of the exit test macros
    (`#expect(exitsWith:) {}` and `try #require(exitsWith:) {}`) to allow
    bodies to throw errors. If they do, they are treated as uncaught errors
    and the child process terminates abnormally (in the same way it does if
    an error is thrown from the main function of a Swift program.)
    
    ### Checklist:
    
    - [x] Code and documentation should follow the style of the [Style
    Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
    - [x] If public symbols are renamed or modified, DocC references should
    be updated.
    grynspan authored Aug 21, 2024
    Copy the full SHA
    a46df3f View commit details
  2. Allow move-only types as suites. (#619)

    This PR enables using move-only types as suites. For example:
    
    ```swift
    @suite struct NumberOfBeesTests: ~Copyable {
      @test consuming func countBees() {
        var count = 0
        for species in allSpecies {
          if species is Bee {
            count += species.populationCount
          }
        }
    
        #expect(count > 0)
      }
    }
    ```
    
    Move-only types have a number of constraints in Swift, and those
    constraints aren't lifted in a test target, but generally speaking a
    move-only type should be able to do all the things any other type can do
    _as a test suite_.
    
    ### Checklist:
    
    - [x] Code and documentation should follow the style of the [Style
    Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
    - [x] If public symbols are renamed or modified, DocC references should
    be updated.
    grynspan authored Aug 21, 2024
    Copy the full SHA
    cd91e93 View commit details
  3. Remove stray use of old SWT_BUILDING_WITH_CMAKE condition. (#621)

    We no longer define `SWT_BUILDING_WITH_CMAKE`, but one file's still
    checking for it. Fix.
    
    ### Checklist:
    
    - [x] Code and documentation should follow the style of the [Style
    Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
    - [x] If public symbols are renamed or modified, DocC references should
    be updated.
    grynspan authored Aug 21, 2024
    Copy the full SHA
    22b0ef1 View commit details
  4. Warn when passing a non-optional value to try #require(T?). (#620)

    This PR adds an overload of `try #require()` that warns the developer if
    they pass a non-optional, non-`Bool` value For example, this code:
    
    ```swift
    let x = 0
    let y = try #require(x)
    ```
    
    Will produce the diagnostic:
    
    > ⚠️ '#require(\_:\_:)' is redundant because 'x' never equals 'nil'
    
    ### Checklist:
    
    - [x] Code and documentation should follow the style of the [Style
    Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
    - [x] If public symbols are renamed or modified, DocC references should
    be updated.
    grynspan authored Aug 21, 2024
    Copy the full SHA
    097db6c View commit details
  5. Reduce overhead of .expectationChecked event handling in `#expect()…

    …`. (#610)
    
    This PR refactors the implementation of `#expect()` and `#require()` a
    bit such that they don't incur more than minimal overhead posting
    `.expectationChecked` events if nobody is listening for them (which,
    currently, nobody is.)
    
    We considered removing `.expectationChecked` outright, but XCTest has
    historically had a number of requests for a way to observe calls to
    `XCTAssert()` etc. even when they pass, so we opted not to remove the
    event kind at this time.
    
    This PR also introduces a cache for fully-qualified type names so that
    we don't need to call into the runtime to get them as often.
    
    Overall speedup is approximately **90% or 11x**. Test time for a tight
    loop of 1,000,000 `#expect()` calls goes from 5.898893 seconds down to
    0.515558291 seconds (as measured on my work computer.)
    
    Resolves rdar://133517028.
    
    ### Checklist:
    
    - [x] Code and documentation should follow the style of the [Style
    Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
    - [x] If public symbols are renamed or modified, DocC references should
    be updated.
    grynspan authored Aug 21, 2024
    Copy the full SHA
    8534698 View commit details
  6. Implement an overload of confirmation() that takes an unbounded ran…

    …ge. (#598)
    
    Unbounded ranges are not meaningful when used with `confirmation()`
    because _any_ confirmation count matches. As well, the `...` operator
    produces an instance of `UnboundedRange` which is a non-nominal type and
    cannot conform to `RangeExpression`. It may be non-obvious to a
    developer why `...` doesn't work as the `expectedCount` argument to that
    function when other range operators work as expected.
    
    This PR implements a stub overload of `confirmation()` that takes an
    unbounded range. The stub overload is marked unavailable and cannot be
    called.
    
    Example usage:
    
    ```swift
    await confirmation("Stuff happens", expectedCount: ...) { stuff in
      // ...
    }
    ```
    
    Generated diagnostic:
    
    > 🛑 'confirmation(\_:expectedCount:sourceLocation:\_:)' is unavailable:
    Unbounded range '...' has no effect when used with a confirmation.
    
    As a reminder, using a range expression with `confirmation()` is an
    experimental feature and has not been API-reviewed.
    
    ### Checklist:
    
    - [x] Code and documentation should follow the style of the [Style
    Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
    - [x] If public symbols are renamed or modified, DocC references should
    be updated.
    grynspan authored Aug 21, 2024
    Copy the full SHA
    bba4bdf View commit details
  7. Fix a merge conflict on main-next. (#627)

    This PR fixes a conflict between #610 and #619. #610 added a string
    cache to `TypeInfo` using `ObjectIdentifier` instances as keys. #619
    added support for move-only types to `TypeInfo`. Due to
    rdar://134276458, move-only types cannot be used with
    `ObjectIdentifier`. This PR uses `UInt` instead until that issue can be
    resolved in a future stdlib update.
    
    ### Checklist:
    
    - [x] Code and documentation should follow the style of the [Style
    Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
    - [x] If public symbols are renamed or modified, DocC references should
    be updated.
    grynspan authored Aug 21, 2024
    Copy the full SHA
    61d4df9 View commit details
  8. Testing: use clock_gettime on Android

    Android recommends `clock_gettime` over `timespec_get` which is
    available at Level 29 and newer. This is needed to build swift-testing
    for Android.
    compnerd committed Aug 21, 2024
    Copy the full SHA
    80e1e94 View commit details
  9. Copy the full SHA
    6ba948a View commit details
  10. Merge pull request #629 from compnerd/android-time

    Testing: use `clock_gettime` on Android
    compnerd authored Aug 21, 2024
    Copy the full SHA
    3fc7f59 View commit details
  11. Disallow @Test on member functions of XCTestCase subclasses. (#626)

    This PR adds a diagnostic if we detect that `@Test` has been used on a
    member function of an `XCTestCase` subclass. This was meant to be
    disallowed, but we neglected to add a check after adopting
    `lexicalContext`.
    
    ### Checklist:
    
    - [x] Code and documentation should follow the style of the [Style
    Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
    - [x] If public symbols are renamed or modified, DocC references should
    be updated.
    grynspan authored Aug 21, 2024
    Copy the full SHA
    92bd26c View commit details
  12. Improve test coverage of CustomTestStringConvertible.swift. (#628)

    This PR adds 100% test coverage to CustomTestStringConvertible.swift.
    
    ### Checklist:
    
    - [x] Code and documentation should follow the style of the [Style
    Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
    - [x] If public symbols are renamed or modified, DocC references should
    be updated.
    grynspan authored Aug 21, 2024
    Copy the full SHA
    2e3ed1f View commit details
  13. Testing: add some force unwraps for Android

    Add some force unwraps to address nullability differences on Android
    from other platforms.
    compnerd committed Aug 21, 2024
    Copy the full SHA
    d080ee2 View commit details
  14. Merge pull request #631 from compnerd/android

    Testing: add some force unwraps for Android
    compnerd authored Aug 21, 2024
    Copy the full SHA
    5772c9a View commit details
  15. Fix incorrectly-specified platform list in CMake file. (#633)

    Our CMake file that sets compiler conditionals has the wrong syntax when
    setting `SWT_NO_EXIT_TESTS` conditionally. Fix that. (With thanks to
    @compnerd.)
    
    ### Checklist:
    
    - [x] Code and documentation should follow the style of the [Style
    Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
    - [x] If public symbols are renamed or modified, DocC references should
    be updated.
    grynspan authored Aug 21, 2024
    Copy the full SHA
    bda8474 View commit details

Commits on Aug 22, 2024

  1. Fix build errors in ExitCondition operators on platforms without ex…

    …it tests. (#635)
    
    On platforms without exit tests, `ExitCondition` is marked unavailable.
    On those platforms, the new operators on `ExitCondition` call each other
    and the compiler complains because they're calling unavailable symbols.
    Silence the compiler.
    
    ### Checklist:
    
    - [x] Code and documentation should follow the style of the [Style
    Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
    - [x] If public symbols are renamed or modified, DocC references should
    be updated.
    grynspan authored Aug 22, 2024
    Copy the full SHA
    888caad View commit details
  2. Merge pull request #636 from swiftlang/main-next

    Merge main-next into main.
    grynspan authored Aug 22, 2024
    Copy the full SHA
    03c6518 View commit details

Commits on Aug 23, 2024

  1. Special-case comparisons of ranges in __checkBinaryOperation(). (#640)

    This PR adds an overload of `__checkBinaryOperation()` that is used when
    the inputs are range expressions. Ranges do not play well with
    collection diffing so we want to disable that functionality for them.
    
    Resolves #639.
    Resolves rdar://131122002.
    
    ### Checklist:
    
    - [x] Code and documentation should follow the style of the [Style
    Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
    - [x] If public symbols are renamed or modified, DocC references should
    be updated.
    grynspan authored Aug 23, 2024
    Copy the full SHA
    60784ff View commit details
  2. Don't define swt_getWASIVersion() on non-WASI. (#632)

    Don't define `swt_getWASIVersion()` on non-WASI. Oops. :)
    
    ### Checklist:
    
    - [x] Code and documentation should follow the style of the [Style
    Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
    - [x] If public symbols are renamed or modified, DocC references should
    be updated.
    grynspan authored Aug 23, 2024
    Copy the full SHA
    9773daa View commit details
  3. Set the library version reported via CMake to 6.1-dev. (#637)

    This PR updates the version reported when using CMake (i.e. when
    building in the toolchain) to `"6.1-dev"` with optional trailing git
    commit hash, if available. The resulting string looks like:
    
    > `6.1.0-dev (c6450e0 - modified)`
    
    "c6450e02cc76cd7" in this example refers to the most recent commit on
    the branch I was testing on via `git rev-parse --verify HEAD`, and
    "modified" is present because I had uncommitted changes.
    
    (We'll want to double-check that CMake used in CI can see the git
    repository and has access to the git tool.)
    
    ### Checklist:
    
    - [x] Code and documentation should follow the style of the [Style
    Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
    - [x] If public symbols are renamed or modified, DocC references should
    be updated.
    grynspan authored Aug 23, 2024
    Copy the full SHA
    a907113 View commit details
  4. [6.0] Fix incorrectly-specified platform list in CMake file. (#634)

    **Explanation:** Correctly sets `SWT_NO_EXIT_TESTS` on platforms that
    don't support them when building with CMake.
    **Scope:** Building iOS, watchOS, tvOS, visionOS, WASI from OSS.
    **Issue:** N/A
    **Original PR:** #633
    **Risk:** Low
    **Testing:** Manually tested as we don't have CI using CMake yet.
    **Reviewer:** @compnerd @briancroom
    grynspan authored Aug 23, 2024
    Copy the full SHA
    b0a306a View commit details

Commits on Aug 26, 2024

  1. Add isolation argument to functions taking non-sendable async closu…

    …res. (#624)
    
    This PR adds an `isolation` parameter to several API functions that take
    `async` closures that are not required to be sendable. As well, it adds
    `sending` to those closures' return types where appropriate.
    
    This change is necessary in Swift 6 because a non-sendable async closure
    could be called in the wrong isolation domain otherwise. In particular,
    if the caller is `@MainActor`-isolated, the closure will not be called
    on the main actor and will therefore always hop, and a concurrency error
    occurs:
    
    ```swift
    @mainactor func f() async {
      await confirmation {
        // this inner closure is not actor-isolated, but can't be sent across
        // isolation domains.
      }
    }
    ```
    
    `withKnownIssue()` and `confirmation()` are affected, as are several
    async overloads of the internal-but-public `__check()` function family.
    
    This change is necessary for correctness, but is potentially
    source-breaking if calling code directly references the modified
    functions by full name.
    
    Resolves #622.
    
    ### Checklist:
    
    - [x] Code and documentation should follow the style of the [Style
    Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
    - [x] If public symbols are renamed or modified, DocC references should
    be updated.
    grynspan authored Aug 26, 2024
    Copy the full SHA
    cac6314 View commit details

Commits on Aug 27, 2024

  1. Generalize optional chaining detection used by #require(). (#625)

    This PR generalizes the optional chaining detection used in the
    implementation of unwrapping `#require()` such that it works with more
    than just member access expressions.
    
    Resolves #623.
    
    ### Checklist:
    
    - [x] Code and documentation should follow the style of the [Style
    Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
    - [x] If public symbols are renamed or modified, DocC references should
    be updated.
    grynspan authored Aug 27, 2024
    Copy the full SHA
    133e302 View commit details

Commits on Aug 28, 2024

  1. Plumb through the testing library version into a function instead of …

    …a C++ macro. (#648)
    
    This PR moves the consumption of the testing library version (via C++
    macro `SWT_TESTING_LIBRARY_VERSION`) to a C++ function. It seems that
    defining it in CMake for C++ targets doesn't trigger for the Swift side
    when it imports symbols from C headers.
    
    Will verify with a toolchain build.
    
    ### Checklist:
    
    - [x] Code and documentation should follow the style of the [Style
    Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
    - [x] If public symbols are renamed or modified, DocC references should
    be updated.
    grynspan authored Aug 28, 2024
    Copy the full SHA
    ab1b0f9 View commit details

Commits on Aug 29, 2024

  1. [CMake] Fix build with SwiftTesting_BuildMacrosAsExecutables option s…

    …et (#645)
    
    Resolve the issues with an out-of-toolchain build from the command line
    with ninja
    
    ### Motivation:
    
    Fixes #644 
    
    ### Modifications:
    
    There were two issues:
        - typo -load-plugin-exectuable -> -load-plugin-executable
        - The executable target for TestingMacros was not installed
    
    ### Result:
    
    A build from the command line with cmake -GNinja -Bbuild will
    successfully complete if SwiftSyntax is not find_package-able
    
    ### Checklist:
    
    - [x] Code and documentation should follow the style of the [Style
    Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
    - [x] If public symbols are renamed or modified, DocC references should
    be updated.
    ADKaster authored Aug 29, 2024
    Copy the full SHA
    d00d469 View commit details

Commits on Aug 30, 2024

  1. Special-case FileHandle(forWritingAtPath: "CONOUT$") on Windows. (#654

    )
    
    This PR special-cases calls to `FileHandle.init(forWritingAtPath:)` when
    passed `"CONOUT$"` (the reserved "console output" file) on Windows such
    that it does not open a new file but just returns a copy of `.stdout`
    instead.
    
    This change is necessary because, on Windows, opening and locking
    `"CONOUT$"` does not lock `stdout` (they're considered entirely
    different files) and output written to `"CONOUT$"` is wrapped at the
    console's column limit even though it's being written as binary data.
    The VSCode Swift plugin authors would like to be able to specify writing
    the JSON event stream to `"CONOUT$"`, but the observed behaviour is
    stopping them from doing so.
    
    ### Checklist:
    
    - [x] Code and documentation should follow the style of the [Style
    Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
    - [x] If public symbols are renamed or modified, DocC references should
    be updated.
    grynspan authored Aug 30, 2024
    Copy the full SHA
    4c1286e View commit details
  2. Add basic platform support for Android. (#653)

    This PR seeks out all the nooks and crannies where we have
    platform-specific code or logic and adds Android. In most cases, it's as
    simple as changing `os(Linux)` to `os(Linux) || os(Android)` but there
    are a few spots where they diverge. The PR should be _mostly_
    self-explanatory.
    
    ### Checklist:
    
    - [x] Code and documentation should follow the style of the [Style
    Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
    - [x] If public symbols are renamed or modified, DocC references should
    be updated.
    
    
    Co-authored-by: Saleem Abdulrasool <compnerd@compnerd.org>
    grynspan and compnerd authored Aug 30, 2024
    Copy the full SHA
    f2c8ee1 View commit details

Commits on Sep 3, 2024

  1. [android] fix 32 bit android build (#656)

    This fixes the following errors:
    ```
    S:/SourceCache/swift-testing/Sources/Testing/Support/FileHandle.swift:423:70: error: cannot convert value of type 'UInt32' to expected argument type 'mode_t' (aka 'UInt16')
    421 |       }
    422 |       var statStruct = stat()
    423 |       return (0 == fstat(fd, &statStruct) && swt_S_ISFIFO(statStruct.st_mode))
        |                                                                      `- error: cannot convert value of type 'UInt32' to expected argument type 'mode_t' (aka 'UInt16')
    424 |     }
    425 | #elseif os(Windows)
    S:/SourceCache/swift-testing/Sources/Testing/Support/GetSymbol.swift:34:73: error: integer literal '4294967295' overflows when stored into 'Int'
    32 | private nonisolated(unsafe) let RTLD_DEFAULT = ImageAddress(bitPattern: -2)
    33 | #elseif os(Android) && _pointerBitWidth(_32)
    34 | private nonisolated(unsafe) let RTLD_DEFAULT = ImageAddress(bitPattern: 0xFFFFFFFF)
       |                                                                         `- error: integer literal '4294967295' overflows when stored into 'Int'
    ```
    
    ### Motivation:
    
    Fix 32 bit android build.
    
    ### Modifications:
    
    Add explicit types to to cast correctly and to pick correct overload.
    
    ### Result:
    
    Android swift-testing will build for armv7k and i686.
    
    ### Checklist:
    
    - [x] Code and documentation should follow the style of the [Style
    Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
    - [x] If public symbols are renamed or modified, DocC references should
    be updated.
    hyp authored Sep 3, 2024
    Copy the full SHA
    8e121e4 View commit details
  2. Optimizations to Backtrace.current(). (#647)

    This PR optimizes `Backtrace.current()`:
    
    - There are now fewer library symbols are captured in a backtrace. This
    particularly affects debug builds where nested scoped accesses aren't
    optimized away.
    - I've eliminated almost all copies of the backtrace's underlying data.
    On 64-bit targets, the only copy required is to final `Array` storage
    and is handled by the standard library.
    - I've eliminated runtime bounds checks on backtrace counts that need to
    be cast from one integer type to another.
    - I've renamed the internal symbol `_startCachingForThrownErrors` to
    `__SWIFT_TESTING_IS_CAPTURING_A_BACKTRACE_FOR_A_THROWN_ERROR__`. This
    symbol unavoidably shows up in backtraces captured when
    `swift_willThrow` is called, so I gave it a name that (hopefully)
    clearly explains why it's there.
    
    ### Checklist:
    
    - [x] Code and documentation should follow the style of the [Style
    Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
    - [x] If public symbols are renamed or modified, DocC references should
    be updated.
    grynspan authored Sep 3, 2024
    Copy the full SHA
    770ff07 View commit details

Commits on Sep 4, 2024

  1. Do not include sysctl.h on Linux. (#660)

    This PR ensures `<sys/sysctl.h>` is not included on Linux, where it
    generates compile-time diagnostics on distros/versions where it's still
    present. The diagnostic looks something like:
    
    ```
    [5/5][100%][7.920s] Linking Swift shared library lib/libTesting.so
    <module-includes>:3:10: note: in file included from <module-includes>:3:
    1 | #include "./Defines.h"
    2 | #include "./Discovery.h"
    3 | #include "./Includes.h"
      |          `- note: in file included from <module-includes>:3:
    4 | #include "./Stubs.h"
    5 | #include "./TestSupport.h"
    
    /home/build-user/swift-testing/Sources/_TestingInternals/include/./Includes.h:61:10: note: in file included from /home/build-user/swift-testing/Sources/_TestingInternals/include/./Includes.h:61:
     59 |
     60 | #if __has_include(<sys/sysctl.h>)
     61 | #include <sys/sysctl.h>
        |          `- note: in file included from /home/build-user/swift-testing/Sources/_TestingInternals/include/./Includes.h:61:
     62 | #endif
     63 |
    ```
    
    Since we don't use `sysctl()` on Linux (and it's been outright removed
    from the OS!), let's fix the diagnostic.
    
    ### Checklist:
    
    - [x] Code and documentation should follow the style of the [Style
    Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
    - [x] If public symbols are renamed or modified, DocC references should
    be updated.
    grynspan authored Sep 4, 2024
    Copy the full SHA
    263545b View commit details
  2. Add support for capturing backtraces from typed throws. (#642)

    Swift 6 introduces the typed throws feature to replace `rethrows` and to
    support error handling in Embedded Swift. This feature uses an ABI that
    differs from the one used by untyped (traditional) `throws` and as such,
    our hook into the runtime (`_swift_willThrow`) is insufficient to
    provide backtrace information for errors thrown this way.
    
    This PR adds support for capturing said backtraces _if and only if_ the
    thrown error is of reference type. Such errors have stable addresses
    that we can track over time, whereas errors of value type will be copied
    when used with typed throws.
    
    ~~I'm also taking the opportunity to implement some performance
    enhancements to `Backtrace`. It shouldn't get called _very_ frequently,
    but it also should be fast!~~ This PR is dependent on #647.
    
    ### Checklist:
    
    - [x] Code and documentation should follow the style of the [Style
    Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
    - [x] If public symbols are renamed or modified, DocC references should
    be updated.
    grynspan authored Sep 4, 2024
    Copy the full SHA
    0ca9774 View commit details
  3. Optimize failureBreakpoint(). (#655)

    `failureBreakpoint()` currently has optimizations disabled which
    produces some significant assembly for what's supposed to be a no-op.
    Enabling optimizations and marking its magic value as
    `@exclusivity(unchecked)` reduces it to a single indirect store.
    
    This is probably not the hottest hot path in the library (since it will
    only be called when a test is failing) but the whole point of the
    function is to be a no-op, and without this change it's _quite_ noisy
    and includes a whole function call into the Swift runtime (see the `bl`
    instructions below.)
    
    ### arm64
    
    #### Before
    ```asm
    _$s7Testing17failureBreakpointyyF:
    0000000000000660	sub	sp, sp, #0x30
    0000000000000664	stp	x29, x30, [sp, #0x20]
    0000000000000668	add	x29, sp, #0x20
    000000000000066c	adrp	x8, 0 ; 0x0
    0000000000000670	add	x0, x8, #0x0
    0000000000000674	add	x1, sp, #0x8
    0000000000000678	mov	x2, #0x21
    000000000000067c	mov	x3, #0x0
    0000000000000680	bl	0x680
    0000000000000684	mov	x8, #0x1
    0000000000000688	adrp	x9, 0 ; 0x0
    000000000000068c	add	x9, x9, #0x0
    0000000000000690	str	x8, [x9]
    0000000000000694	add	x0, sp, #0x8
    0000000000000698	bl	0x698
    000000000000069c	ldp	x29, x30, [sp, #0x20]
    00000000000006a0	add	sp, sp, #0x30
    00000000000006a4	ret
    ```
    
    #### After
    ```asm
    _$s7Testing17failureBreakpointyyF:
    0000000000000660	adrp	x8, 0 ; 0x0
    0000000000000664	str	xzr, [x8]
    0000000000000668	ret
    ```
    
    Note this disassembly comes from the intermediate .o file generated for
    the relevant source file, so addresses aren't available yet. Neither
    function actually attempts to write to 0x0.
    
    ### Checklist:
    
    - [x] Code and documentation should follow the style of the [Style
    Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
    - [x] If public symbols are renamed or modified, DocC references should
    be updated.
    grynspan authored Sep 4, 2024
    Copy the full SHA
    294544a View commit details
  4. Add an EditorConfig file (#600)

    Add an EditorConfig (`.editorconfig`) file to this repo.
    
    ### Motivation:
    
    [EditorConfig](https://editorconfig.org) helps maintain consistent
    coding styles for multiple developers working on the same project across
    various editors and IDEs. It will be helpful to add one of these files
    to swift-testing so that all contributors use the whitespace conventions
    described in our [style
    guide](https://github.com/swiftlang/swift-testing/blob/main/Documentation/StyleGuide.md)
    automatically when using a supported IDE/editor.
    
    Note that Xcode 16 Beta has added support for EditorConfig files — see
    20796230 in the [release
    notes](https://developer.apple.com/documentation/xcode-release-notes/xcode-16-release-notes).
    
    ### Checklist:
    
    - [x] Code and documentation should follow the style of the [Style
    Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
    - [x] If public symbols are renamed or modified, DocC references should
    be updated.
    stmontgomery authored Sep 4, 2024
    Copy the full SHA
    5720222 View commit details
  5. Remove #expect(throws: Never.self) and `#require(throws: Never.self…

    …)` as distinct overloads. (#661)
    
    `#expect(throws: Never.self)` and `#require(throws: Never.self)` do not
    need to be specified as separate overloads. This PR removes them as
    distinct symbols:
    
    - The documentation for `#expect(throws: Never.self)` is merged into the
    documentation for `#expect(throws:)`.
    - The diagnostic emitted when using `#require(throws: Never.self)` is
    lowered from a deprecation warning to a macro-generated custom warning.
    
    This change has no other compile-time or runtime effects: code that
    passes `Never.self` to either macro will continue to compile, and macros
    cannot be referenced so there is no risk of source-level breakage like
    there might be from a function signature change.
    
    ### Checklist:
    
    - [x] Code and documentation should follow the style of the [Style
    Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
    - [x] If public symbols are renamed or modified, DocC references should
    be updated.
    grynspan authored Sep 4, 2024
    Copy the full SHA
    9de9084 View commit details

Commits on Sep 5, 2024

  1. Fix test

    grynspan committed Sep 5, 2024
    Copy the full SHA
    36da714 View commit details
  2. Revert "Fix test"

    This reverts commit 36da714.
    grynspan committed Sep 5, 2024
    Copy the full SHA
    c1b072b View commit details
  3. Replace rethrows with typed throws in Graph (#662)

    This replaces usage of `rethrows` with [typed
    throws](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0413-typed-throws.md)
    in the internal-only `Graph` support type.
    
    ### Motivation:
    
    It's now
    [recommended](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0413-typed-throws.md#when-to-use-typed-throws)
    to use typed throws in generic code that never produces its own errors,
    but only passes through errors that come from callers. And adopting
    typed throws in more places will reduce barriers to eventually
    supporting Embedded Swift.
    
    ### Modifications:
    
    - Replace all usage of `rethrows` with the analogous typed throws
    declaration in `Graph`.
    
    ### Result:
    
    No behavioral/runtime change.
    
    ### Checklist:
    
    - [x] Code and documentation should follow the style of the [Style
    Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
    - [x] If public symbols are renamed or modified, DocC references should
    be updated.
    stmontgomery authored Sep 5, 2024
    Copy the full SHA
    20c4440 View commit details
  4. Work around compiler regression causing CI failure. (#664)

    This PR attempts to work around the compiler regression reported in
    rdar://135346598 that is currently causing our macOS CI jobs to fail.
    
    ### Checklist:
    
    - [x] Code and documentation should follow the style of the [Style
    Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
    - [x] If public symbols are renamed or modified, DocC references should
    be updated.
    grynspan authored Sep 5, 2024
    Copy the full SHA
    23619cc View commit details
  5. Work around swiftinterface generation bug on Windows. (#663)

    Works around the issue described in
    swiftlang/swift#76279.
    
    ### Checklist:
    
    - [x] Code and documentation should follow the style of the [Style
    Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
    - [x] If public symbols are renamed or modified, DocC references should
    be updated.
    grynspan authored Sep 5, 2024
    Copy the full SHA
    5f62e01 View commit details
  6. Work around the swiftinterface generation issue for Android too

    This is a follow-up to 5f62e01, as the same issue also hits the Android build
    hyp committed Sep 5, 2024
    Copy the full SHA
    6caae62 View commit details
  7. Merge pull request #665 from swiftlang/eng/android-workaround

    Work around the swiftinterface generation issue for Android too
    hyp authored Sep 5, 2024
    Copy the full SHA
    ca51589 View commit details

Commits on Sep 6, 2024

  1. Don't use Synchronization.Atomic for `deliverExpectationCheckedEven…

    …ts`. (#666)
    
    This PR replaces the new use of `Atomic<Int>` with a `Locked<Int>` in
    the implementation of `deliverExpectationCheckedEvents`. Why? Because
    we're running into some environments where the Synchronization module
    isn't available (e.g. older host macOSes) and this is simpler. The
    performance profile is comparable: on my system, running the
    `repeatedlyExpect()` test takes 0.55s instead of 0.49s to call
    `#expect()` 1,000,000 times, so it's still a significant win over the
    implementation we had earlier.
    
    ### Checklist:
    
    - [x] Code and documentation should follow the style of the [Style
    Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
    - [x] If public symbols are renamed or modified, DocC references should
    be updated.
    grynspan authored Sep 6, 2024
    Copy the full SHA
    2e9df4f View commit details
  2. Exit tests shouldn't emit crash logs. (#670)

    When a process crashes, the platforms we support all write a crash log
    (or core, or error report) to disk. This is not necessary for exit test
    child processes (since we intentionally crash them.)
    
    This PR suppresses generation of those logs from within an exit test:
    
    - On Darwin, we disable the exception port for crash report files;
    - On Linux, we set the maximum core dump size to zero bytes; and
    - On Windows, we disable Windows Error Reporting.
    
    The above effects are only applied to the exit test's child process, not
    to the parent test process nor the system as a whole.
    
    ### Checklist:
    
    - [x] Code and documentation should follow the style of the [Style
    Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
    - [x] If public symbols are renamed or modified, DocC references should
    be updated.
    grynspan authored Sep 6, 2024
    Copy the full SHA
    c120149 View commit details

Commits on Sep 8, 2024

  1. CMake: Install _TestingInternals in static library builds

    When building the Testing library as a static library
    (BUILD_SHARED_LIBS=FALSE), `_TestingInternals` was not being installed
    alongside the main library. This caused the missing symbol error when
    linking against the Testing library statically.
    kateinoigakukun committed Sep 8, 2024
    Copy the full SHA
    ed97c9c View commit details
  2. Copy the full SHA
    f078f7a View commit details
  3. Fix a typo in a call of install path getter function name

    This is a follow-up fix to f078f7a that I made at the last
    minute before merging...
    kateinoigakukun committed Sep 8, 2024
    Copy the full SHA
    090e9c8 View commit details
  4. Do not include <sys/resource.h> on WASI

    Including `sys/resource.h` from wasi-libc requires a feature macro to be
    defined (`-D_WASI_EMULATED_PROCESS_CLOCKS`) and emits compilation errors
    otherwise. However, the header is not used in WASI paths, so it is safe
    to exclude it from the list of includes.
    
    See `sys/times.h` that is transitively included by `sys/resource.h`
    https://github.com/WebAssembly/wasi-libc/blob/wasi-sdk-22/libc-top-half/musl/include/sys/times.h
    kateinoigakukun committed Sep 8, 2024
    Copy the full SHA
    12a7ddf View commit details
  5. Merge pull request #672 from kateinoigakukun/yt/fix-last-min-change

    Fix a typo in a call of install path getter function name
    kateinoigakukun authored Sep 8, 2024
    Copy the full SHA
    e7a7e23 View commit details

Commits on Sep 9, 2024

  1. Ask Foundation to capture NSError/CFError backtraces for us. (#673)

    On Apple platforms, when an error occurs in an Objective-C method or C
    function, convention is to return the error as an instance of
    `NSError`/`CFError` via an out-parameter. When that Objective-C method
    or C function is called by a Swift function, the Swift function detects
    the error, then effectively rethrows it, at which point our
    `swift_willThrow` hook is triggered. This can obscure the real origin of
    the error which may be many stack frames down from the point Swift takes
    over.
    
    This PR asks Foundation, via a relatively new internal function, to
    capture backtraces for instances of `NSError` and `CFError` at the point
    they are created. Then, when Swift Testing attempts to look up the
    backtrace for an error it has caught, if Foundation has generated one,
    then Swift Testing can substitute it in place of the one it generated in
    the `swift_willThrow` hook.
    
    Resolves rdar://114386243.
    
    ### Checklist:
    
    - [x] Code and documentation should follow the style of the [Style
    Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
    - [x] If public symbols are renamed or modified, DocC references should
    be updated.
    grynspan authored Sep 9, 2024
    Copy the full SHA
    f6af3d8 View commit details

Commits on Sep 10, 2024

  1. Expose the target triple as a separate string from the testing librar…

    …y version. (#652)
    
    This PR adds a script to our CMake build to capture the target triple
    being used to build Swift Testing so that we can include it in our
    diagnostic output.
    
    Apple's fork of Swift Testing (as included with Xcode 16) also includes
    this information, and it is very useful to have when reviewing bug
    reports as it can tell us if a problem is specific to a given
    architecture or OS variant.
    
    ### Checklist:
    
    - [x] Code and documentation should follow the style of the [Style
    Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
    - [x] If public symbols are renamed or modified, DocC references should
    be updated.
    grynspan authored Sep 10, 2024
    Copy the full SHA
    a0c8fc6 View commit details
Showing with 15,846 additions and 5,196 deletions.
  1. +11 −0 .editorconfig
  2. +74 −0 .github/ISSUE_TEMPLATE/01-bug-report.yml
  3. +68 −0 .github/ISSUE_TEMPLATE/02-change-request.yml
  4. +36 −0 .github/ISSUE_TEMPLATE/03-task.yml
  5. +0 −39 .github/ISSUE_TEMPLATE/BUG_REPORT.yml
  6. +0 −39 .github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml
  7. +43 −0 .github/ISSUE_TEMPLATE/config.yml
  8. +0 −4 .github/PULL_REQUEST_TEMPLATE.md
  9. +1 −0 .gitignore
  10. +1 −2 .spi.yml
  11. +26 −8 CMakeLists.txt
  12. +1 −1 CODEOWNERS
  13. +44 −13 CONTRIBUTING.md
  14. +1 −1 Documentation/ABI/JSON.md
  15. +297 −0 Documentation/ABI/TestContent.md
  16. +405 −0 Documentation/ExpectationCapture.md
  17. +348 −0 Documentation/Porting.md
  18. +0 −184 Documentation/Proposals/0000-proposal-template.md
  19. +8 −166 Documentation/Proposals/0001-refactor-bug-inits.md
  20. +6 −419 Documentation/Proposals/0002-json-abi.md
  21. +8 −149 Documentation/Proposals/0003-make-serialized-trait-api.md
  22. +8 −201 Documentation/Proposals/0004-constrain-the-granularity-of-test-time-limit-durations.md
  23. +10 −0 Documentation/Proposals/0005-ranged-confirmations.md
  24. +10 −0 Documentation/Proposals/0006-return-errors-from-expect-throws.md
  25. +10 −0 Documentation/Proposals/0007-test-scoping-traits.md
  26. +28 −6 Documentation/README.md
  27. +0 −138 Documentation/Releases.md
  28. +6 −4 Documentation/SPI.md
  29. +25 −0 Documentation/StyleGuide.md
  30. +44 −0 Documentation/WASI.md
  31. +143 −25 Package.swift
  32. +9 −10 README.md
  33. +5 −3 Sources/CMakeLists.txt
  34. +9 −0 Sources/Overlays/CMakeLists.txt
  35. +89 −0 Sources/Overlays/_Testing_CoreGraphics/Attachments/AttachableAsCGImage.swift
  36. +116 −0 Sources/Overlays/_Testing_CoreGraphics/Attachments/Attachment+AttachableAsCGImage.swift
  37. +20 −0 Sources/Overlays/_Testing_CoreGraphics/Attachments/CGImage+AttachableAsCGImage.swift
  38. +34 −0 Sources/Overlays/_Testing_CoreGraphics/Attachments/ImageAttachmentError.swift
  39. +178 −0 Sources/Overlays/_Testing_CoreGraphics/Attachments/_AttachableImageContainer.swift
  40. +1 −1 Sources/{_Testing_Foundation → Overlays/_Testing_CoreGraphics}/ReexportTesting.swift
  41. +28 −0 Sources/Overlays/_Testing_Foundation/Attachments/Attachable+Encodable+NSSecureCoding.swift
  42. +93 −0 Sources/Overlays/_Testing_Foundation/Attachments/Attachable+Encodable.swift
  43. +74 −0 Sources/Overlays/_Testing_Foundation/Attachments/Attachable+NSSecureCoding.swift
  44. +250 −0 Sources/Overlays/_Testing_Foundation/Attachments/Attachment+URL.swift
  45. +21 −0 Sources/Overlays/_Testing_Foundation/Attachments/Data+Attachable.swift
  46. +56 −0 Sources/Overlays/_Testing_Foundation/Attachments/EncodingFormat.swift
  47. +68 −0 Sources/Overlays/_Testing_Foundation/Attachments/_AttachableURLContainer.swift
  48. +40 −0 Sources/Overlays/_Testing_Foundation/CMakeLists.txt
  49. 0 Sources/{ → Overlays}/_Testing_Foundation/Events/Clock+Date.swift
  50. +1 −3 Sources/{Testing/ABI/v0/ABIv0.swift → Overlays/_Testing_Foundation/ReexportTesting.swift}
  51. +117 −0 Sources/SymbolShowcase/SymbolShowcaseMain.swift
  52. +107 −0 Sources/Testing/ABI/ABI.Record+Streaming.swift
  53. +26 −16 Sources/Testing/ABI/{v0/ABIv0.Record.swift → ABI.Record.swift}
  54. +86 −0 Sources/Testing/ABI/ABI.swift
  55. +32 −0 Sources/Testing/ABI/Encoded/ABI.EncodedAttachment.swift
  56. +44 −0 Sources/Testing/ABI/Encoded/ABI.EncodedBacktrace.swift
  57. +67 −0 Sources/Testing/ABI/Encoded/ABI.EncodedError.swift
  58. +22 −10 Sources/Testing/ABI/{v0/Encoded/ABIv0.EncodedEvent.swift → Encoded/ABI.EncodedEvent.swift}
  59. +3 −3 Sources/Testing/ABI/{v0/Encoded/ABIv0.EncodedInstant.swift → Encoded/ABI.EncodedInstant.swift}
  60. +68 −0 Sources/Testing/ABI/Encoded/ABI.EncodedIssue.swift
  61. +10 −4 Sources/Testing/ABI/{v0/Encoded/ABIv0.EncodedMessage.swift → Encoded/ABI.EncodedMessage.swift}
  62. +29 −9 Sources/Testing/ABI/{v0/Encoded/ABIv0.EncodedTest.swift → Encoded/ABI.EncodedTest.swift}
  63. +45 −67 Sources/Testing/ABI/EntryPoints/ABIEntryPoint.swift
  64. +160 −84 Sources/Testing/ABI/EntryPoints/EntryPoint.swift
  65. +1 −1 Sources/Testing/ABI/EntryPoints/SwiftPMEntryPoint.swift
  66. +0 −111 Sources/Testing/ABI/v0/ABIv0.Record+Streaming.swift
  67. +0 −38 Sources/Testing/ABI/v0/Encoded/ABIv0.EncodedIssue.swift
  68. +161 −0 Sources/Testing/Attachments/Attachable.swift
  69. +31 −0 Sources/Testing/Attachments/AttachableContainer.swift
  70. +512 −0 Sources/Testing/Attachments/Attachment.swift
  71. +47 −12 Sources/Testing/CMakeLists.txt
  72. +49 −0 Sources/Testing/Discovery+Macro.swift
  73. +16 −3 Sources/Testing/Events/Clock.swift
  74. +37 −13 Sources/Testing/Events/Event.swift
  75. +47 −19 Sources/Testing/Events/Recorder/Event.ConsoleOutputRecorder.swift
  76. +98 −47 Sources/Testing/Events/Recorder/Event.HumanReadableOutputRecorder.swift
  77. +12 −5 Sources/Testing/Events/Recorder/Event.JUnitXMLRecorder.swift
  78. +34 −8 Sources/Testing/Events/Recorder/Event.Symbol.swift
  79. +4 −0 Sources/Testing/Events/TimeValue.swift
  80. +152 −0 Sources/Testing/ExitTests/ExitTest.Condition.swift
  81. +86 −0 Sources/Testing/ExitTests/ExitTest.Result.swift
  82. +560 −228 Sources/Testing/ExitTests/ExitTest.swift
  83. +379 −0 Sources/Testing/ExitTests/SpawnProcess.swift
  84. +22 −53 Sources/Testing/ExitTests/{ExitCondition.swift → StatusAtExit.swift}
  85. +111 −47 Sources/Testing/ExitTests/WaitFor.swift
  86. +213 −59 Sources/Testing/Expectations/Expectation+Macro.swift
  87. +81 −32 Sources/Testing/Expectations/ExpectationChecking+Macro.swift
  88. +64 −55 Sources/Testing/Issues/Confirmation.swift
  89. +20 −60 Sources/Testing/Issues/Issue+Recording.swift
  90. +190 −85 Sources/Testing/Issues/Issue.swift
  91. +33 −13 Sources/Testing/Issues/KnownIssue.swift
  92. +10 −3 Sources/Testing/Parameterization/CustomTestArgumentEncodable.swift
  93. +42 −17 Sources/Testing/Parameterization/Test.Case.Generator.swift
  94. +97 −22 Sources/Testing/Parameterization/Test.Case.ID.swift
  95. +158 −32 Sources/Testing/Parameterization/Test.Case.swift
  96. +174 −58 Sources/Testing/Parameterization/TypeInfo.swift
  97. +36 −1 Sources/Testing/Running/Configuration+EventHandling.swift
  98. +184 −62 Sources/Testing/Running/Configuration.TestFilter.swift
  99. +162 −22 Sources/Testing/Running/Configuration.swift
  100. +0 −1 Sources/Testing/Running/Runner.Plan+Dumping.swift
  101. +108 −37 Sources/Testing/Running/Runner.Plan.swift
  102. +63 −7 Sources/Testing/Running/Runner.RuntimeState.swift
  103. +68 −87 Sources/Testing/Running/Runner.swift
  104. +10 −3 Sources/Testing/Running/SkipInfo.swift
  105. +165 −0 Sources/Testing/SourceAttribution/Backtrace+Symbolication.swift
  106. +239 −41 Sources/Testing/SourceAttribution/Backtrace.swift
  107. +97 −27 Sources/Testing/SourceAttribution/Expression.swift
  108. +18 −5 Sources/Testing/SourceAttribution/SourceContext.swift
  109. +39 −10 Sources/Testing/SourceAttribution/SourceLocation.swift
  110. +55 −15 Sources/Testing/Support/Additions/CommandLineAdditions.swift
  111. +9 −0 Sources/Testing/Support/Additions/NumericAdditions.swift
  112. +33 −1 Sources/Testing/Support/Additions/ResultAdditions.swift
  113. +53 −0 Sources/Testing/Support/Additions/WinSDKAdditions.swift
  114. +6 −0 Sources/Testing/Support/CError.swift
  115. +10 −10 Sources/Testing/Support/CartesianProduct.swift
  116. +86 −0 Sources/Testing/Support/CustomIssueRepresentable.swift
  117. +6 −6 Sources/Testing/Support/Environment.swift
  118. +194 −8 Sources/Testing/Support/FileHandle.swift
  119. +14 −24 Sources/Testing/Support/GetSymbol.swift
  120. +34 −34 Sources/Testing/Support/Graph.swift
  121. +1 −1 Sources/Testing/Support/JSON.swift
  122. +107 −0 Sources/Testing/Support/Locked+Platform.swift
  123. +76 −74 Sources/Testing/Support/Locked.swift
  124. +0 −23 Sources/Testing/Support/SystemError.swift
  125. +35 −5 Sources/Testing/Support/Versions.swift
  126. +47 −0 Sources/Testing/Test+Discovery+Legacy.swift
  127. +77 −109 Sources/Testing/Test+Discovery.swift
  128. +115 −101 Sources/Testing/Test+Macro.swift
  129. +1 −1 Sources/Testing/Test.swift
  130. +0 −4 Sources/Testing/Testing.docc/DefiningTests.md
  131. +0 −1 Sources/Testing/Testing.docc/Documentation.md
  132. +6 −7 Sources/Testing/Testing.docc/Expectations.md
  133. +3 −2 Sources/Testing/Testing.docc/LimitingExecutionTime.md
  134. +210 −144 Sources/Testing/Testing.docc/MigratingFromXCTest.md
  135. +0 −178 Sources/Testing/Testing.docc/TemporaryGettingStarted.md
  136. +6 −5 Sources/Testing/Testing.docc/Traits.md
  137. +9 −11 Sources/Testing/Testing.docc/Traits/Trait.md
  138. +141 −8 Sources/Testing/Testing.docc/known-issues.md
  139. +32 −3 Sources/Testing/Testing.docc/testing-asynchronous-code.md
  140. +37 −2 Sources/Testing/Testing.docc/testing-for-errors-in-swift-code.md
  141. +3 −0 Sources/Testing/Testing.swiftcrossimport/Foundation.swiftoverlay
  142. +11 −11 Sources/Testing/Traits/Bug.swift
  143. +47 −9 Sources/Testing/Traits/Comment.swift
  144. +9 −2 Sources/Testing/Traits/ConditionTrait+Macro.swift
  145. +76 −84 Sources/Testing/Traits/ConditionTrait.swift
  146. +20 −23 Sources/Testing/Traits/ParallelizationTrait.swift
  147. +0 −38 Sources/Testing/Traits/SPIAwareTrait.swift
  148. +4 −3 Sources/Testing/Traits/Tags/Tag.Color+Loading.swift
  149. +23 −28 Sources/Testing/Traits/TimeLimitTrait.swift
  150. +234 −61 Sources/Testing/Traits/Trait.swift
  151. +8 −4 Sources/TestingMacros/CMakeLists.txt
  152. +192 −40 Sources/TestingMacros/ConditionMacro.swift
  153. +94 −0 Sources/TestingMacros/PragmaMacro.swift
  154. +4 −0 Sources/TestingMacros/SourceLocationMacro.swift
  155. +60 −24 Sources/TestingMacros/SuiteDeclarationMacro.swift
  156. +24 −8 Sources/TestingMacros/Support/Additions/FunctionDeclSyntaxAdditions.swift
  157. +18 −0 Sources/TestingMacros/Support/Additions/IntegerLiteralExprSyntaxAdditions.swift
  158. +44 −45 Sources/TestingMacros/Support/Additions/MacroExpansionContextAdditions.swift
  159. +41 −1 Sources/TestingMacros/Support/Additions/TokenSyntaxAdditions.swift
  160. +1 −0 Sources/TestingMacros/Support/Additions/TypeSyntaxProtocolAdditions.swift
  161. +8 −4 Sources/TestingMacros/Support/Additions/WithAttributesSyntaxAdditions.swift
  162. +1 −0 Sources/TestingMacros/Support/Argument.swift
  163. +63 −36 Sources/TestingMacros/Support/AttributeDiscovery.swift
  164. +42 −7 Sources/TestingMacros/Support/AvailabilityGuards.swift
  165. +1 −0 Sources/TestingMacros/Support/CommentParsing.swift
  166. +32 −25 Sources/TestingMacros/Support/ConditionArgumentParsing.swift
  167. +3 −4 Sources/TestingMacros/Support/DiagnosticMessage+Diagnosing.swift
  168. +100 −31 Sources/TestingMacros/Support/DiagnosticMessage.swift
  169. +2 −0 Sources/TestingMacros/Support/SourceCodeCapturing.swift
  170. +1 −0 Sources/TestingMacros/Support/SourceLocationGeneration.swift
  171. +98 −0 Sources/TestingMacros/Support/TestContentGeneration.swift
  172. +5 −0 Sources/TestingMacros/TagMacro.swift
  173. +139 −125 Sources/TestingMacros/TestDeclarationMacro.swift
  174. +4 −0 Sources/TestingMacros/TestingMacrosMain.swift
  175. +90 −0 Sources/_TestDiscovery/Additions/WinSDKAdditions.swift
  176. +32 −0 Sources/_TestDiscovery/CMakeLists.txt
  177. +55 −0 Sources/_TestDiscovery/DiscoverableAsTestContent.swift
  178. +380 −0 Sources/_TestDiscovery/SectionBounds.swift
  179. +102 −0 Sources/_TestDiscovery/TestContentKind.swift
  180. +290 −0 Sources/_TestDiscovery/TestContentRecord.swift
  181. +21 −2 Sources/_TestingInternals/CMakeLists.txt
  182. +27 −237 Sources/_TestingInternals/Discovery.cpp
  183. +35 −0 Sources/_TestingInternals/Versions.cpp
  184. +12 −0 Sources/_TestingInternals/WillThrow.cpp
  185. +0 −11 Sources/_TestingInternals/include/Defines.h
  186. +60 −0 Sources/_TestingInternals/include/Demangle.h
  187. +31 −22 Sources/_TestingInternals/include/Discovery.h
  188. +60 −9 Sources/_TestingInternals/include/Includes.h
  189. +35 −23 Sources/_TestingInternals/include/Stubs.h
  190. +53 −0 Sources/_TestingInternals/include/Versions.h
  191. +48 −0 Sources/_TestingInternals/include/WillThrow.h
  192. +44 −8 Tests/TestingMacrosTests/ConditionMacroTests.swift
  193. +45 −0 Tests/TestingMacrosTests/PragmaMacroTests.swift
  194. +61 −3 Tests/TestingMacrosTests/TestDeclarationMacroTests.swift
  195. +5 −0 Tests/TestingMacrosTests/TestSupport/Parse.swift
  196. +7 −15 Tests/TestingMacrosTests/UniqueIdentifierTests.swift
  197. +69 −18 Tests/TestingTests/ABIEntryPointTests.swift
  198. +651 −0 Tests/TestingTests/AttachmentTests.swift
  199. +114 −5 Tests/TestingTests/BacktraceTests.swift
  200. +25 −0 Tests/TestingTests/ConfigurationTests.swift
  201. +67 −20 Tests/TestingTests/ConfirmationTests.swift
  202. +79 −0 Tests/TestingTests/CustomTestStringConvertibleTests.swift
  203. +161 −0 Tests/TestingTests/DiscoveryTests.swift
  204. +81 −0 Tests/TestingTests/EntryPointTests.swift
  205. +194 −48 Tests/TestingTests/EventRecorderTests.swift
  206. +4 −4 Tests/TestingTests/EventTests.swift
  207. +231 −51 Tests/TestingTests/ExitTestTests.swift
  208. +131 −5 Tests/TestingTests/Expression.ValueTests.swift
  209. +214 −25 Tests/TestingTests/IssueTests.swift
  210. +8 −0 Tests/TestingTests/KnownIssueTests.swift
  211. +67 −19 Tests/TestingTests/MiscellaneousTests.swift
  212. +33 −0 Tests/TestingTests/NonCopyableSuiteTests.swift
  213. +3 −1 Tests/TestingTests/ObjCInteropTests.swift
  214. +145 −14 Tests/TestingTests/PlanTests.swift
  215. +1 −1 Tests/TestingTests/Runner.RuntimeStateTests.swift
  216. +56 −17 Tests/TestingTests/RunnerTests.swift
  217. +1 −1 Tests/TestingTests/SkipInfoTests.swift
  218. +42 −15 Tests/TestingTests/SourceLocationTests.swift
  219. +1 −1 Tests/TestingTests/Support/EnvironmentTests.swift
  220. +82 −20 Tests/TestingTests/Support/FileHandleTests.swift
  221. +43 −6 Tests/TestingTests/Support/LockTests.swift
  222. +61 −21 Tests/TestingTests/SwiftPMTests.swift
  223. +16 −16 Tests/TestingTests/Test.Case.Argument.IDTests.swift
  224. +20 −20 Tests/TestingTests/Test.Case.ArgumentTests.swift
  225. +31 −0 Tests/TestingTests/Test.Case.GeneratorTests.swift
  226. +177 −0 Tests/TestingTests/Test.CaseTests.swift
  227. +3 −2 Tests/TestingTests/TestCaseSelectionTests.swift
  228. +54 −11 Tests/TestingTests/TestSupport/TestingAdditions.swift
  229. +25 −0 Tests/TestingTests/Traits/CommentTests.swift
  230. +62 −0 Tests/TestingTests/Traits/ConditionTraitTests.swift
  231. +0 −104 Tests/TestingTests/Traits/CustomExecutionTraitTests.swift
  232. +1 −11 Tests/TestingTests/Traits/ParallelizationTraitTests.swift
  233. +1 −1 Tests/TestingTests/Traits/TagListTests.swift
  234. +184 −0 Tests/TestingTests/Traits/TestScopingTraitTests.swift
  235. +7 −4 Tests/TestingTests/Traits/TimeLimitTraitTests.swift
  236. +55 −1 Tests/TestingTests/TypeInfoTests.swift
  237. +1 −1 Tests/TestingTests/TypeNameConflictTests.swift
  238. +27 −23 cmake/modules/LibraryVersion.cmake
  239. +48 −0 cmake/modules/PlatformInfo.cmake
  240. +24 −55 cmake/modules/SwiftModuleInstallation.cmake
  241. +22 −0 cmake/modules/TargetTriple.cmake
  242. +2 −0 cmake/modules/shared/AvailabilityDefinitions.cmake
  243. +14 −2 cmake/modules/shared/CompilerSettings.cmake
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# EditorConfig documentation: https://editorconfig.org

root = true

# Default settings applied to every file type.
[*]
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
74 changes: 74 additions & 0 deletions .github/ISSUE_TEMPLATE/01-bug-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2025 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

name: 🪲 Report a bug
description: >
Report a deviation from expected or documented behavior.
labels: [bug, triage-needed]
body:
- type: markdown
attributes:
value: >
This repository hosts the Swift Testing library and its documentation.
It does _not_ track feedback for Xcode and other closed source Apple
developer software such as XCTest; please direct that to
[Feedback Assistant](https://developer.apple.com/bug-reporting) instead.
- type: textarea
attributes:
label: Description
description: >
A concise description of what causes the problem, in human language.
Though not required, it may help us to more accurately triage the issue
as well as understand a non-trivial test case.
validations:
required: false
- type: textarea
attributes:
label: Reproduction
description: >
Provide an example, preferably in a Markdown code block, and explain how
to build or run it to reproduce the problem. If the problem is a poor or
unexpected diagnostic, fix-it, or other output, please show this output
as is. For example, paste it from the terminal. Consider reducing the
example to the smallest amount of code possible — a smaller example is
easier to reason about and more appealing to contributors.
value: |
```swift
```
validations:
required: true
- type: textarea
attributes:
label: Expected behavior
description: Describe the behavior you expected.
validations:
required: true
- type: textarea
attributes:
label: Environment
description: >
Provide details about the environment in which this problem occurs.
Include the versions of Swift Testing and the Swift toolchain. If you
suspect the problem might be specific to a particular platform, please
specify the platform and OS version as well.
placeholder: |
Swift Testing version: (shown in `swift test` output)
$ swift --version
$ uname -a
validations:
required: true
- type: textarea
attributes:
label: Additional information
description: >
Any complementary information that could help others to work around the
problem, and us to better understand the problem and its impact. For
example, a link to a discussion or post that motivated this report.
validations:
required: false
68 changes: 68 additions & 0 deletions .github/ISSUE_TEMPLATE/02-change-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2025 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

name: 🌟 Request a change
description: >
Request a feature, API, improvement, or other change.
labels: [enhancement, triage-needed]
body:
- type: markdown
attributes:
value: >
This repository hosts the Swift Testing library and its documentation.
It does _not_ track feedback for Xcode and other closed source Apple
developer software such as XCTest; please direct that to
[Feedback Assistant](https://developer.apple.com/bug-reporting) instead.
___
Swift Testing is guided by a community-driven evolution process.
Submitting this form is not a guarantee that the request will be
considered or implemented. If the request implies an addition, removal,
or change to the features of Swift Testing or its public interfaces,
please consider socializing it on the
[Swift forums](https://forums.swift.org/c/related-projects/swift-testing)
instead. The Swift forums are the preferred space for sharing ideas and
discussing them with the Swift community.
- type: textarea
attributes:
label: Motivation
description: >
Describe the problems that this idea seeks to address. If the problem is
that some common pattern is currently hard to express, show how one can
currently get a similar effect and describe its drawbacks. If it's
completely new functionality that cannot be emulated, motivate why this
new functionality would help create better Swift tests.
validations:
required: true
- type: textarea
attributes:
label: Proposed solution
description: >
Describe the proposed solution to the problem. Provide examples and
describe how they work. Show how this solution is better than current
workarounds: is it cleaner, safer, or more efficient?
validations:
required: true
- type: textarea
attributes:
label: Alternatives considered
description: >
Any alternative approaches that were considered, and why the _proposed
solution_ was chosen instead.
validations:
required: false
- type: textarea
attributes:
label: Additional information
description: >
Any complementary information that could be valuable to an author of a
formal proposal, an implementor, or future discussions. For example, a
link to a discussion or post that motivated this request.
validations:
required: false
36 changes: 36 additions & 0 deletions .github/ISSUE_TEMPLATE/03-task.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2025 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

name: ⚙️ Track a task
description: >
Tasks can be used to track internal work, extract individual subtasks from a
larger issue, or can serve as umbrella issues themselves.
labels: []
body:
- type: markdown
attributes:
value: >
This repository hosts the Swift Testing library and its documentation.
It does _not_ track feedback for Xcode and other closed source Apple
developer software such as XCTest; please direct that to
[Feedback Assistant](https://developer.apple.com/bug-reporting) instead.
- type: textarea
attributes:
label: Description
description: >
A comprehensive description of the task, in human language.
validations:
required: true
- type: textarea
attributes:
label: Additional information
description: >
Any complementary information that could be valuable to an implementor.
For example, a link to a discussion or post that motivated this task.
validations:
required: false
39 changes: 0 additions & 39 deletions .github/ISSUE_TEMPLATE/BUG_REPORT.yml

This file was deleted.

39 changes: 0 additions & 39 deletions .github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml

This file was deleted.

43 changes: 43 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2025 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

blank_issues_enabled: true
contact_links:
- name: 🌐 Discuss an idea
url: https://forums.swift.org/c/related-projects/swift-testing
about: >
Share an idea with the Swift Testing community.
- name: 📄 Formally propose a change
url: https://github.com/swiftlang/swift-testing/blob/main/Documentation/Proposals/0000-proposal-template.md
about: >
Formally propose an addition, removal, or change to the APIs or features
of Swift Testing.
- name: 🙋 Ask a question
url: https://forums.swift.org/c/related-projects/swift-testing
about: >
Ask a question about or get help with Swift Testing. Beginner questions
welcome!
- name: 🪲 Report an issue with Swift Package Manager
url: https://github.com/swiftlang/swift-package-manager/issues/new/choose
about: >
Report an issue with Swift Package Manager, which includes the
"swift test" CLI tool.
- name: 🪲 Report an issue with Apple software using Feedback Assistant
url: https://developer.apple.com/bug-reporting
about: >
Report an issue with Xcode or other closed source Apple developer
software such as XCTest.
- name: 🪲 Report an issue with the VS Code Swift plugin
url: https://github.com/swiftlang/vscode-swift/issues/new/choose
about: >
Report an issue with the Swift plugin for VS Code, which integrates with
Swift Testing.
- name: 📖 Learn about Swift Testing
url: https://swiftpackageindex.com/swiftlang/swift-testing/main/documentation/testing
about: >
Read the official Swift Testing documentation.
4 changes: 0 additions & 4 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -8,10 +8,6 @@ _[Explain here the context, and why you're making that change. What is the probl

_[Describe the modifications you've done.]_

### Result:

_[After your change, what will change.]_

### Checklist:

- [ ] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.DS_Store
/.build
/.index-build
/build
/Packages
/*.xcodeproj
3 changes: 1 addition & 2 deletions .spi.yml
Original file line number Diff line number Diff line change
@@ -3,6 +3,5 @@ metadata:
authors: Apple Inc.
builder:
configs:
- swift_version: 6.0
documentation_targets: [Testing]
- documentation_targets: [Testing]
scheme: Testing
34 changes: 26 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -9,12 +9,26 @@
cmake_minimum_required(VERSION 3.19.6...3.29)

if(POLICY CMP0157)
cmake_policy(SET CMP0157 NEW)
if(CMAKE_HOST_SYSTEM_NAME STREQUAL Windows AND CMAKE_SYSTEM_NAME STREQUAL Android)
# CMP0157 causes builds to fail when targetting Android with the Windows
# toolchain, because the early swift-driver isn't (yet) available. Disable
# it for now.
cmake_policy(SET CMP0157 OLD)
else()
cmake_policy(SET CMP0157 NEW)
endif()
endif()

project(SwiftTesting
LANGUAGES CXX Swift)

if(NOT APPLE)
if(NOT CMAKE_SYSTEM_NAME STREQUAL WASI)
find_package(dispatch CONFIG)
endif()
find_package(Foundation CONFIG)
endif()

include(GNUInstallDirs)

list(APPEND CMAKE_MODULE_PATH
@@ -25,17 +39,21 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

set(CMAKE_INSTALL_RPATH "$<IF:$<PLATFORM_ID:Darwin>,@loader_path/..,$ORIGIN>")
set(CMAKE_INSTALL_REMOVE_ENVIRONMENT_RPATH YES)

set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreadedDLL)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_Swift_LANGUAGE_VERSION 6)
set(CMAKE_Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift)

if(NOT SWIFT_SYSTEM_NAME)
if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
set(SWIFT_SYSTEM_NAME macosx)
else()
set(SWIFT_SYSTEM_NAME "$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>")
endif()
endif()
include(PlatformInfo)
include(SwiftModuleInstallation)

option(SwiftTesting_INSTALL_NESTED_SUBDIR "Install libraries under a platform and architecture subdirectory" NO)
set(SwiftTesting_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}/swift$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:_static>/${SwiftTesting_PLATFORM_SUBDIR}$<$<AND:$<PLATFORM_ID:Darwin>,$<NOT:$<BOOL:${SwiftTesting_INSTALL_NESTED_SUBDIR}>>>:/testing>$<$<BOOL:${SwiftTesting_INSTALL_NESTED_SUBDIR}>:/${SwiftTesting_ARCH_SUBDIR}>")
set(SwiftTesting_INSTALL_SWIFTMODULEDIR "${CMAKE_INSTALL_LIBDIR}/swift$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:_static>/${SwiftTesting_PLATFORM_SUBDIR}$<$<AND:$<PLATFORM_ID:Darwin>,$<NOT:$<BOOL:${SwiftTesting_INSTALL_NESTED_SUBDIR}>>>:/testing>")

add_compile_options($<$<COMPILE_LANGUAGE:Swift>:-no-toolchain-stdlib-rpath>)

add_subdirectory(Sources)
Loading