Browse Source

test: add a test to check that final method can not be overriden

git-svn-id: branches/paul/features@13891 -
paul 16 years ago
parent
commit
d23257db28
2 changed files with 27 additions and 0 deletions
  1. 1 0
      .gitattributes
  2. 26 0
      tests/test/tfinal2.pp

+ 1 - 0
.gitattributes

@@ -8204,6 +8204,7 @@ tests/test/texception8.pp svneol=native#text/plain
 tests/test/texception9.pp svneol=native#text/plain
 tests/test/tfillchr.pp svneol=native#text/plain
 tests/test/tfinal1.pp svneol=native#text/pascal
+tests/test/tfinal2.pp svneol=native#text/pascal
 tests/test/tfpu1.pp svneol=native#text/plain
 tests/test/tfpu2.pp svneol=native#text/plain
 tests/test/tfpu3.pp svneol=native#text/plain

+ 26 - 0
tests/test/tfinal2.pp

@@ -0,0 +1,26 @@
+{ %fail}
+{$ifdef fpc}
+{$mode objfpc}
+{$endif}
+
+type
+  TClassWithFinalMethod = class
+  public
+    procedure TestFinal; virtual; final;
+  end;
+
+  TClassTryOverrideFinal = class(TClassWithFinalMethod)
+  public
+    procedure TestFinal; override;
+  end;
+
+procedure TClassWithFinalMethod.TestFinal;
+begin
+end;
+
+procedure TClassTryOverrideFinal.TestFinal;
+begin
+end;
+
+begin
+end.