You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the library only tests the RegexLiterals versions. Ideally, the library should test all Regexes including those written in the Swift DSL (in the RegexBuilders namespace).
But I would like to do this in a way that is scalable and does not require rewriting tests. In other words it should be possible to use the same test to test RegexBuilders.ssn as we use to test RegexLiterals.ssn. Currently this isn't possible. The reason is because Regex and RegexComponent are not Sendable. If it were, we could pass it into the test as a parameter, in the same way that we pass the Strings to make reusable tests.
If we rewrote the tests by hand, this would work, but inevitably the tests would be out of sync and less reliable. It would also be more of a hassle to contributors.
Possible Solutions
It's possible that we could create a concrete type-erased AnyRegexComponent type that could be Sendable. Using this, perhaps we could have reusable tests.
Currently the library only tests the
RegexLiterals
versions. Ideally, the library should test all Regexes including those written in the Swift DSL (in theRegexBuilders
namespace).But I would like to do this in a way that is scalable and does not require rewriting tests. In other words it should be possible to use the same test to test
RegexBuilders.ssn
as we use to testRegexLiterals.ssn
. Currently this isn't possible. The reason is becauseRegex
andRegexComponent
are notSendable
. If it were, we could pass it into the test as a parameter, in the same way that we pass theString
s to make reusable tests.If we rewrote the tests by hand, this would work, but inevitably the tests would be out of sync and less reliable. It would also be more of a hassle to contributors.
Possible Solutions
It's possible that we could create a concrete type-erased
AnyRegexComponent
type that could beSendable
. Using this, perhaps we could have reusable tests.Additional Context
The text was updated successfully, but these errors were encountered: