Skip to content

Commit

Permalink
Merge branch 'main' into fix-parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
stephencelis authored Sep 9, 2024
2 parents 185a92f + b41188c commit c484969
Show file tree
Hide file tree
Showing 15 changed files with 384 additions and 133 deletions.
44 changes: 29 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,15 @@ jobs:
config:
- debug
- release
xcode:
- 15.4
- 15.2
name: macOS
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- name: Select Xcode
run: sudo xcode-select -s /Applications/Xcode_15.4.app
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
- name: Run tests
run: make test-${{ matrix.config }}

Expand All @@ -51,7 +54,7 @@ jobs:
- name: Select Xcode
run: sudo xcode-select -s /Applications/Xcode_15.4.app
- name: Run tests
run: CONFIG=${{ matrix.config }} make test-examples
run: make CONFIG=${{ matrix.config }} test-examples

linux:
strategy:
Expand All @@ -69,20 +72,31 @@ jobs:
- name: Run tests
run: make test-${{ matrix.config }}
- name: Build for static-stdlib
run: CONFIG=${{ matrix.config }} make build-for-static-stdlib
run: make CONFIG=${{ matrix.config }} build-for-static-stdlib

# NB: Downloading the toolchain gets rate-limited by GitHub
# wasm:
# name: Wasm
# runs-on: macos-14
# steps:
# - uses: actions/checkout@v4
# - name: Select Xcode
# run: sudo xcode-select -s /Applications/Xcode_15.4.app
# - name: Select Swift version
# run: echo 'wasm-DEVELOPMENT-SNAPSHOT-2024-07-08-a' > .swift-version
# - name: Build
# run: swift run carton bundle
wasm:
name: SwiftWasm
runs-on: ubuntu-latest
strategy:
matrix:
toolchain:
- wasm-5.9.2-RELEASE
- wasm-5.10.0-RELEASE
steps:
- name: Cache toolchains
uses: actions/cache@v3
with:
path: ~/Library/Developer/Toolchains
key: ${{ matrix.toolchain }}
- uses: actions/checkout@v4
- uses: bytecodealliance/actions/wasmtime/setup@v1
- uses: swiftwasm/setup-swiftwasm@v1
with:
swift-version: ${{ matrix.toolchain }}
- name: Build tests
run: swift build --triple wasm32-unknown-wasi --build-tests -Xlinker -z -Xlinker stack-size=$((1024 * 1024))
- name: Run tests
run: wasmtime .build/debug/xctest-dynamic-overlayPackageTests.wasm

windows:
name: Windows
Expand Down
18 changes: 14 additions & 4 deletions Examples/ExamplesTests/SwiftTestingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,27 @@
@Suite
struct SwiftTestingTests_Debug {
@Test func context() {
#expect(TestContext.current == .swiftTesting)
switch TestContext.current {
case .xcTest:
#expect(Bool(true))
default:
Issue.record()
}
}

@Test func reportIssue_NoMessage() {
withKnownIssue {
reportIssue()
} matching: { issue in
issue.description == "Expectation failed: "
issue.description == "Issue recorded"
}
}

@Test func reportIssue_CustomMessage() {
withKnownIssue {
reportIssue("Something went wrong")
} matching: { issue in
issue.description == "Expectation failed: Something went wrong"
issue.description == "Issue recorded: Something went wrong"
}
}

Expand Down Expand Up @@ -68,7 +73,12 @@
@Suite
struct SwiftTestingTests_Release {
@Test func context() {
#expect(TestContext.current == .xcTest)
switch TestContext.current {
case .xcTest:
#expect(Bool(true))
default:
Issue.record()
}
}

@Test func reportIssueDoesNotFail() {
Expand Down
14 changes: 12 additions & 2 deletions Examples/ExamplesTests/XCTestTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ import XCTest
#if DEBUG
class XCTestTests_Debug: XCTestCase {
func testContext() {
XCTAssertEqual(TestContext.current, .xcTest)
switch TestContext.current {
case .xcTest:
XCTAssert(true)
default:
XCTFail()
}
}

#if _runtime(_ObjC)
Expand Down Expand Up @@ -49,7 +54,12 @@ import XCTest
#else
class XCTestTests_Release: XCTestCase {
func testContext() {
XCTAssertEqual(TestContext.current, .xcTest)
switch TestContext.current {
case .xcTest:
XCTAssert(true)
default:
XCTFail()
}
}

func testReportIssueDoesNotFail() {
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
XCODE_PATH := $(shell xcode-select -p)
CONFIG := debug

# NB: We can't rely on `XCTExpectFailure` because it doesn't exist in `swift-corelibs-foundation`
PASS = \033[1;7;32m PASS \033[0m
Expand Down Expand Up @@ -50,4 +51,4 @@ test-linux:
-v "$(PWD):$(PWD)" \
-w "$(PWD)" \
swift:5.10 \
bash -c 'swift test'
bash -c 'swift test -c $(CONFIG)'
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

- ``unimplemented(_:fileID:filePath:function:line:column:)-2ae22``
- ``unimplemented(_:fileID:filePath:function:line:column:)-1hsov``
- ``unimplemented(_:throwing:fileID:filePath:function:line:column:)-4h958``
- ``unimplemented(_:throwing:fileID:filePath:function:line:column:)-5zfy9``
- ``unimplemented(_:placeholder:fileID:filePath:function:line:column:)-6ts5j``
- ``unimplemented(_:placeholder:fileID:filePath:function:line:column:)-34tpp``

Expand Down
Loading

0 comments on commit c484969

Please sign in to comment.