commit d094aa6d31061aa6ce8de98d6b7e3e80e883093b
parent c27a08761a2f73976cb99cbc951677d96324d0ff
Author: kyle <kyle@getaddrinfo.net>
Date: Sun, 1 Nov 2015 21:22:29 -0700
tests: add return statement regress test
Diffstat:
4 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/tests/return/Makefile b/tests/return/Makefile
@@ -0,0 +1,11 @@
+BIN = prog
+SRCS = return.c
+OBJS = $(SRCS:c=o)
+
+$(BIN): $(OBJS)
+ $(CC) -o $(BIN) $(OBJS) $(LDLIBS)
+
+diff:
+ diff -u return.c.inst{_good,}
+
+.include "../Makefile.test"
diff --git a/tests/return/return.c b/tests/return/return.c
@@ -0,0 +1,15 @@
+int
+foo()
+{
+ return 0;
+}
+
+int
+main(void)
+{
+ return 10;
+
+ return 10 + 10;
+
+ return foo();
+}
diff --git a/tests/return/return.c.inst_good b/tests/return/return.c.inst_good
@@ -0,0 +1,18 @@
+unsigned int lines[91];
+int size = 91;
+char file_name[] = "/home/kyle/src/scv/tests/return/return.c";
+int
+foo()
+{
+ return (lines[4] = 1, 0);
+}
+
+int
+main(void)
+{
+ return (lines[10] = 1, 10);
+
+ return (lines[12] = 1, 10 + 10);
+
+ return (lines[14] = 1, (lines[14] = 1, foo()));
+}
diff --git a/tests/return/test.sh b/tests/return/test.sh