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

Add support for Swift Testing... #281

Closed
woolie opened this issue Aug 11, 2024 · 5 comments
Closed

Add support for Swift Testing... #281

woolie opened this issue Aug 11, 2024 · 5 comments

Comments

@woolie
Copy link
Contributor

woolie commented Aug 11, 2024

Is your feature request related to a problem? Please describe.
When using Swift Testing in Swift 6, trying to do an #expect(throws: XMLDeserializationError.***) {} fails to compile due to a requirement of Error types to be equatable using the #expect macro, which I assume is needed for enums with associated values (since I have not seem this problem crop us when I have used it without enum associated values).

Describe the solution you'd like
I'd like equatable to be added for the errors enums

Describe alternatives you've considered
For now I am commenting out my testing in those areas where I am expecting errors thrown.

Additional context

@drmohundro
Copy link
Owner

Interesting... I haven't looked into Swift 6 compatibility yet, but there are some issues. It looks like SWXMLHash can build under Swift 6, but when I try to run the tests under it, those just crash.

I'll have to do some research into what will be needed for full Swift 6 support.

@drmohundro
Copy link
Owner

drmohundro commented Aug 16, 2024

I've got a draft PR up at #283... branch is feat/swift-6-support. swift test is still failing for me, but I don't know if that is for a different reason. I think the #expects(throws: XMLDeserializationError.self) should work, though I'm not positive yet... I'm still working through getting the branch tested.

Feel free to give it a try to see if it works for you, though.

EDIT - swift test works for me now. My CI/CD script is still messed up, but that works. 🤞🏻 that it might work for you, too!

@woolie
Copy link
Contributor Author

woolie commented Sep 8, 2024

It doesn't work for me.

	@Test func shouldThrowWhenConvertingEmptyToNonOptional() async throws {
		#expect(throws: XMLDeserializationError.nodeHasNoValue) {
			try (parser!["root"]["empty"].value() as ComplexItem)
		}
	}

Still has an issue with the XMLDeserializationError.nodeHasNoValue not having an equatable conformance.

@woolie
Copy link
Contributor Author

woolie commented Sep 8, 2024

Nevermind, read the code woolie. It works fine with your changes.

@woolie woolie closed this as completed Sep 8, 2024
@drmohundro
Copy link
Owner

That's great, thanks for verifying! I'll plan to merge and get a major version released with this once the latest Xcode is stable... I've got the builds mostly green, but they're inconsistent because of the Xcode betas I think.

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

No branches or pull requests

2 participants