With our beloved Rust SDK, I would be able to use expected panic behavior for my tests, i.e.
#[should_panic(expected = "MyExpectedError")
Now that I’m forced to use in-language tests, I couldn’t find something like that. Generally speaking, my issue with `#[test(should_revert)] is that I don’t really know what reverts, so it could be an unexpected bug. Is there anything like should_panic(expected = …) already and if not, will it come soon?
Funny addition to the above: If I do use #[should_panic(expected = "MyExpectation")] my test would just ALWAYS successfully pass, regardless of whether it panics or not. There is neither an error nor a warning that this flag doesn’t do anything and if anybody would use this because it’s in the Rust SDK, this could seriously fuck up some tests.
Thanks for the question. We have an open issue to track the exact thing you described here. I will get in touch internally to see if the blockers of the issue resolved.
There are scenarios where in-language testing gets the job done faster and scenarios where you’d need the SDK and a general-purpose language to test something properly.
Don’t get me wrong, I really like and appreciate the feature. I was just rolling with the sway-applications tests structure for contracts and then I tried to write library tests with a comparable structure and I couldn’t get it working. So I was “forced” to choose it, still going relatively smoothly for now