Stream: beginners

Topic: Expect a crash?


view this post on Zulip Aurélien Geron (Sep 11 2024 at 21:48):

Is it possible to expect a crash?
Crashes are not really meant to ever happen, so it might be odd to expect a crash, but there are some scenarios where this is desirable: for example, I'm working on an exercise on exercism.org to teach error handling. One of the scenarios involves getting the user to write a function that crashes with a "To-Do" message. I don't know how to test that right now.

view this post on Zulip Brendan Hansknecht (Sep 12 2024 at 00:59):

It is not

view this post on Zulip Brendan Hansknecht (Sep 12 2024 at 00:59):

At least not without a custom test platform for exercism

view this post on Zulip Brendan Hansknecht (Sep 12 2024 at 01:29):

Actually, now that I think about it, tests run on a custom platform built into the compiler, so we could technically make it support expect-crash, but it would be a special keyword and larger project

view this post on Zulip Richard Feldman (Sep 12 2024 at 02:02):

personally I think I'd just explain what it is and not make a test for it

view this post on Zulip Richard Feldman (Sep 12 2024 at 02:02):

people will understand :big_smile:

view this post on Zulip Brendan Hansknecht (Sep 12 2024 at 02:09):

personally I think I'd just explain what it is and not make a test for it

Yeah, probably for the best.

view this post on Zulip Aurélien Geron (Sep 12 2024 at 04:23):

Sounds good, thanks for your feedback


Last updated: Jul 06 2025 at 12:14 UTC