changeset 203:85ed61918ae4

added "intervening finally" tests for break and goto
author thomask
date Thu, 16 Dec 2004 06:56:08 +0000
parents 4cd33115f015
children fcaf1782c71d
files run/break_08.d run/break_09.d run/goto_10.d run/goto_11.d todo.txt
diffstat 5 files changed, 155 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/run/break_08.d	Thu Dec 16 06:56:08 2004 +0000
@@ -0,0 +1,42 @@
+// $HeadURL$
+// $Date$
+// $Author$
+
+module dstress.run.break_08;
+
+int status;
+
+int test(char[][] args){
+loop:	while(1){	
+		try{
+			try{
+				if(args.length==1){
+					break loop;
+				}
+			}finally{
+				assert(status==0);
+				status+=2;
+			}
+
+			try{
+				assert(0);
+			}finally{
+				assert(0);
+			}
+		}finally{
+			assert(status==2);
+			status+=3;
+		}
+		assert(0);
+		return 0;
+	}
+	return -1;
+}
+
+int main(char[][] args){
+	assert(status == 0);
+	assert(args.length == 1);
+	assert(test(args) == -1);
+	assert(status == 5);
+	return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/run/break_09.d	Thu Dec 16 06:56:08 2004 +0000
@@ -0,0 +1,36 @@
+// $HeadURL$
+// $Date$
+// $Author$
+
+module dstress.run.break_09;
+
+int status;
+
+int test(char[][] args){
+
+loop:	while(1){
+		try{
+			try{
+				if(args.length==1){
+					break loop;
+				}
+			}finally{
+				assert(status==0);
+				status+=2;
+			}
+		}finally{
+			assert(status==2);
+			status+=3;
+		}
+		return 0;
+	}
+	return -1;
+}
+
+int main(char[][] args){
+	assert(status == 0);
+	assert(args.length == 1);
+	assert(test(args) == -1);
+	assert(status == 5);
+	return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/run/goto_10.d	Thu Dec 16 06:56:08 2004 +0000
@@ -0,0 +1,41 @@
+// $HeadURL$
+// $Date$
+// $Author$
+
+module dstress.run.goto_10;
+
+int status;
+
+int test(char[][] args){
+	try{
+		try{
+			if(args.length==1){
+				goto end;
+			}
+		}finally{
+			assert(status==0);
+			status+=2;
+		}
+
+		try{
+			assert(0);
+		}finally{
+			assert(0);
+		}
+	}finally{
+		assert(status==2);
+		status+=3;
+	}
+	assert(0);
+	return 0;
+end:
+	return -1;
+}
+
+int main(char[][] args){
+	assert(status == 0);
+	assert(args.length == 1);
+	assert(test(args) == -1);
+	assert(status == 5);
+	return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/run/goto_11.d	Thu Dec 16 06:56:08 2004 +0000
@@ -0,0 +1,34 @@
+// $HeadURL$
+// $Date$
+// $Author$
+
+module dstress.run.return_04;
+
+int status;
+
+int test(char[][] args){
+	try{
+		try{
+			if(args.length==1){
+				goto end;
+			}
+		}finally{
+			assert(status==0);
+			status+=2;
+		}
+	}finally{
+		assert(status==2);
+		status+=3;
+	}
+	return 0;
+end:
+	return -1;
+}
+
+int main(char[][] args){
+	assert(status == 0);
+	assert(args.length == 1);
+	assert(test(args) == -1);
+	assert(status == 5);
+	return 0;
+}
--- a/todo.txt	Wed Dec 15 17:37:40 2004 +0000
+++ b/todo.txt	Thu Dec 16 06:56:08 2004 +0000
@@ -12,7 +12,7 @@
 
 Test cases:
 * keyword: asm
-* keyword: break (intervening finally clauses; mutexes)
+* keyword: break (mutexes)
 * keyword: in out body
 * keyword: cent
 * keyword: cdouble
@@ -23,7 +23,7 @@
 * keyword: export
 * keyword: extern
 * keyword: function
-* keyword: goto (intervening finally clauses; synchronization objects/mutexes)
+* keyword: goto (synchronization objects/mutexes)
 * keyword: idouble
 * keyword: ifloat
 * keyword: import