Closed djangovanderheijden closed 5 months ago
Hi @djangovanderheijden, our XCTFail
from xctest-dynamic-overlay does a runtime warning under the hood when not in tests.
So this does currently behave as described in the docs. Are you seeing otherwise? Also, this definitely should not crash the app. Are you seeing that?
Hey @mbrandonw, interesting. I did see a crash in my application (with the debugger attached, but not while testing). I'll take another look and get back to you
Alright, the issue seems unrelated to CasePaths (sorry about that, I should've read the error on my colleague's screen better) but I am definitely seeing crashes:
This happens in a clean, newly created project that's ran for the first time. Here's a small repro:
@CasePathable
enum Foo {
case bar(String)
case baz
}
struct ContentView: View {
var body: some View {
Text("Foo")
.onAppear {
var foo = Foo.baz
foo.modify(\.bar) {
$0 = "bar"
}
}
}
}
Ah I see, this will be fixed with https://github.com/pointfreeco/xctest-dynamic-overlay/pull/81. Thanks for the heads up!
Nice! I'll close this.
As per the documentation:
In reality, calling
modify
with a non-matching case will always callXCTFail
. This PR adds ComposableArchitecture'sRuntimeWarnings.swift
file and usesruntimeWarn
instead ofXCTFail
.Alternatively, we could consider changing the documentation to clarify that the use of a non-matching case causes a runtime crash. I'm open to either solution, but a warning log seems a bit more graceful.