Skip to content
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

Migrate to Swift Testing #99

Merged
merged 12 commits into from
Feb 4, 2025

Conversation

M7md-Ebrahim
Copy link
Contributor

Migrate to Swift Testing #92

@@ -11,22 +11,21 @@
//
//===----------------------------------------------------------------------===//

import XCTest
import Testing
import WebAuthn

func assertThrowsError<T, E: Error>(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can probably drop this helper altogether now, can't we?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this helper is beneficial. Why would we want to drop it?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't swift Testing have a new #expect(throws: ...) { ... } that would replace this helper?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does yes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But doesn’t this work the same as XCTAssertThrowsError?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, I’ll work on that

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But doesn’t this work the same as XCTAssertThrowsError?

I assume these were there because XCTAssert didn't handle async code very well, so this abstracted over that with a single signature

@@ -11,22 +11,21 @@
//
//===----------------------------------------------------------------------===//

import XCTest
import Testing
import WebAuthn

func assertThrowsError<T, E: Error>(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

@dimitribouniol
Copy link
Collaborator

@0xTim I assume we are ok dropping Swift 5 support for this, right?

@0xTim
Copy link
Member

0xTim commented Jan 31, 2025

Yes this is a new library and we're yet to hit 1.0.0 so I don't see an issue with dropping older versions of Swift, especially for the server world

This was referenced Feb 1, 2025
@dimitribouniol
Copy link
Collaborator

@M7md-Ebrahim When you can, please rebase off of main and tests should pass. With assertThrowsError replaced, we should be able to get this merged in, thanks!

dimitribouniol and others added 6 commits February 2, 2025 05:15
…-webauthn into swift_testing

# Conflicts:
#	Tests/WebAuthnTests/Utils/assert+async.swift
#	Tests/WebAuthnTests/Utils/assert+expect.swift
#	Tests/WebAuthnTests/WebAuthnManagerAuthenticationTests.swift
#	Tests/WebAuthnTests/WebAuthnManagerRegistrationTests.swift
Copy link
Collaborator

@dimitribouniol dimitribouniol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this migration!

@dimitribouniol dimitribouniol merged commit 6e6c012 into swift-server:main Feb 4, 2025
15 checks passed
@M7md-Ebrahim M7md-Ebrahim deleted the swift_testing branch February 4, 2025 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants