trilemma-dev / SecureXPC

A simple and secure XPC framework for Swift
MIT License
75 stars 15 forks source link

Makes repeated route registration result in `fatalError` instead of an `Error` #68

Closed jakaplan closed 2 years ago

jakaplan commented 2 years ago

In doing so, slightly consolidates the internal implementation of route registration.

jakaplan commented 2 years ago

Follow up from feedback for #64

@amomchilov for your review

jakaplan commented 2 years ago

Also @amomchilov do you know of any (non-hacky) way to test fatalError? It'd be nice to write a unit test or two that ensured that fatalError is in fact occurring in the case of duplicative route registration.

amomchilov commented 2 years ago

@jakaplan It's possible, but it's currently one of my biggest pain points in Swift.

Check out https://github.com/mattgallagher/CwlPreconditionTesting. It has an accompanying blog post series: https://www.cocoawithlove.com/blog/2016/02/02/partial-functions-part-two-catching-precondition-failures.html

I've never used CwlPreconditionTesting directly, only through the throwAssertion() matcher in Nimble.