Updated 26 Apr 2021
Sometimes when testing code, it is desirable to not only make sure that the code executes correctly when it should, but also to check that it throws errors or warning when expected. These simple utilities make it easy to test if the expected alerting behavior takes place.
shoulderror: throws an error if the code executes successfully without error.
shouldwarn: throws an error if the code executes without warning.
shouldalert: throws an error if the code executes without either an error or warning.
Sky Sartorius (2023). Alert Checking (https://github.com/sky-s/alert-checking), GitHub. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Versions that use the GitHub default branch cannot be downloaded