From f41a1c5f5118fe07b99d783a8b78f6ec52ee51f6 Mon Sep 17 00:00:00 2001 From: "zik.saleeba" Date: Sat, 1 Mar 2014 04:28:48 +0000 Subject: [PATCH] Added tests for issue #191. git-svn-id: http://picoc.googlecode.com/svn/trunk@607 21eae674-98b7-11dd-bd71-f92a316d2d60 --- tests/68_return.c | 34 ++++++++++++++++++++++++++++++++++ tests/68_return.expect | 2 ++ tests/Makefile | 1 + 3 files changed, 37 insertions(+) create mode 100644 tests/68_return.c create mode 100644 tests/68_return.expect 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