diff --git a/tests/68_return.c b/tests/68_return.c new file mode 100644 index 0000000..46fd7b4 --- /dev/null +++ b/tests/68_return.c @@ -0,0 +1,34 @@ +#include + +void demo_error() +{ + int value = 5; + + printf("Here's a print statement before quitting.\n"); + + if(1) { + printf("returning; there should be no further output.\n"); + return; + } + + printf("This statement should not print, and does not.\n"); + + switch(value) + { + case 5: + printf("case 5: value = %d\n", value); + break; + case 0: + printf("case 0: value=%d\n", value); + break; + } + + printf("This statement also should not and does not print.\n"); + + return; +} + +void main() +{ + demo_error(); +} diff --git a/tests/68_return.expect b/tests/68_return.expect new file mode 100644 index 0000000..763ef34 --- /dev/null +++ b/tests/68_return.expect @@ -0,0 +1,2 @@ +Here's a print statement before quitting. +returning; there should be no further output. diff --git a/tests/Makefile b/tests/Makefile index f3a5894..643a9ae 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -61,6 +61,7 @@ TESTS= 00_assignment.test \ 64_double_prefix_op.test \ 66_printf_undefined.test \ 67_macro_crash.test \ + 68_return.test \ include csmith/Makefile