changeset 15:fa94281987cf

added tests for final keyword
author unknown
date Fri, 08 Oct 2004 07:36:36 +0000
parents b1c36563cbed
children 0fcca61f008f
files nocompile/final_01.d nocompile/final_04.d nocompile/final_07.d nocompile/final_08.d nocompile/final_09.d nocompile/final_10.d nocompile/final_11.d run/final_02.d run/final_03.d run/final_05.d run/final_06.d
diffstat 11 files changed, 95 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nocompile/final_01.d	Fri Oct 08 07:36:36 2004 +0000
@@ -0,0 +1,9 @@
+class Parent{
+	final void test(){
+	}
+}
+
+class Child : Parent{
+	void test(){
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nocompile/final_04.d	Fri Oct 08 07:36:36 2004 +0000
@@ -0,0 +1,1 @@
+final int x;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nocompile/final_07.d	Fri Oct 08 07:36:36 2004 +0000
@@ -0,0 +1,3 @@
+final struct MyStruct{
+	int dummy;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nocompile/final_08.d	Fri Oct 08 07:36:36 2004 +0000
@@ -0,0 +1,1 @@
+final module MyModule;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nocompile/final_09.d	Fri Oct 08 07:36:36 2004 +0000
@@ -0,0 +1,3 @@
+class MyClass{
+	final int test;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nocompile/final_10.d	Fri Oct 08 07:36:36 2004 +0000
@@ -0,0 +1,3 @@
+struct MyStruct{
+	final int test;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nocompile/final_11.d	Fri Oct 08 07:36:36 2004 +0000
@@ -0,0 +1,4 @@
+struct MyStruct{
+	final void test(){
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/run/final_02.d	Fri Oct 08 07:36:36 2004 +0000
@@ -0,0 +1,17 @@
+class Parent{
+	final private int test(){
+		return 3;
+	}
+}
+
+class Child : Parent{
+	int test(){
+		return 5;
+	}
+}
+
+int main(){
+	Child c = new Child();
+	assert(c.test()==5);
+	return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/run/final_03.d	Fri Oct 08 07:36:36 2004 +0000
@@ -0,0 +1,17 @@
+class Parent{
+	int test(){
+		return 3;
+	}
+}
+
+class Child : Parent{
+	final int test(){
+		return 5;
+	}
+}
+
+int main(){
+	Child c = new Child();
+	assert(c.test()==5);
+	return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/run/final_05.d	Fri Oct 08 07:36:36 2004 +0000
@@ -0,0 +1,17 @@
+class Parent{
+	final int test(){
+		return 3;
+	}
+}
+
+class Child : Parent{
+	private int test(){
+		return 5;
+	}
+}
+
+int main(){
+	Child c = new Child();
+	assert(c.test()==5);
+	return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/run/final_06.d	Fri Oct 08 07:36:36 2004 +0000
@@ -0,0 +1,20 @@
+class Parent{
+	final int test(){
+		return 3;
+	}
+}
+
+class Child : Parent{
+	private int test(){
+		return 5;
+	}
+}
+
+class GrandChild : Child{
+}
+
+int main(){
+	GrandChild c = new GrandChild();
+	assert(c.test()==5);
+	return 0;
+}