From 9b059099448e4f8a720feb2ca6949a0467a95424 Mon Sep 17 00:00:00 2001 From: svenbarth Date: Fri, 7 Jan 2011 22:02:01 +0000 Subject: [PATCH] I don't know why, but the tests 3-34 weren't commited the first time although I selected all of them git-svn-id: branches/svenbarth/classhelpers@16731 - --- .gitattributes | 32 ++++++++++++++++++++++++++++++++ tests/test/tchlp10.pp | 25 +++++++++++++++++++++++++ tests/test/tchlp11.pp | 23 +++++++++++++++++++++++ tests/test/tchlp12.pp | 34 ++++++++++++++++++++++++++++++++++ tests/test/tchlp13.pp | 43 +++++++++++++++++++++++++++++++++++++++++++ tests/test/tchlp14.pp | 32 ++++++++++++++++++++++++++++++++ tests/test/tchlp15.pp | 34 ++++++++++++++++++++++++++++++++++ tests/test/tchlp16.pp | 18 ++++++++++++++++++ tests/test/tchlp17.pp | 17 +++++++++++++++++ tests/test/tchlp18.pp | 23 +++++++++++++++++++++++ tests/test/tchlp19.pp | 21 +++++++++++++++++++++ tests/test/tchlp20.pp | 20 ++++++++++++++++++++ tests/test/tchlp21.pp | 19 +++++++++++++++++++ tests/test/tchlp22.pp | 35 +++++++++++++++++++++++++++++++++++ tests/test/tchlp23.pp | 32 ++++++++++++++++++++++++++++++++ tests/test/tchlp24.pp | 19 +++++++++++++++++++ tests/test/tchlp25.pp | 17 +++++++++++++++++ tests/test/tchlp26.pp | 23 +++++++++++++++++++++++ tests/test/tchlp27.pp | 21 +++++++++++++++++++++ tests/test/tchlp28.pp | 28 ++++++++++++++++++++++++++++ tests/test/tchlp29.pp | 28 ++++++++++++++++++++++++++++ tests/test/tchlp3.pp | 19 +++++++++++++++++++ tests/test/tchlp30.pp | 21 +++++++++++++++++++++ tests/test/tchlp31.pp | 21 +++++++++++++++++++++ tests/test/tchlp32.pp | 19 +++++++++++++++++++ tests/test/tchlp33.pp | 21 +++++++++++++++++++++ tests/test/tchlp34.pp | 20 ++++++++++++++++++++ tests/test/tchlp4.pp | 18 ++++++++++++++++++ tests/test/tchlp5.pp | 18 ++++++++++++++++++ tests/test/tchlp6.pp | 27 +++++++++++++++++++++++++++ tests/test/tchlp7.pp | 25 +++++++++++++++++++++++++ tests/test/tchlp8.pp | 18 ++++++++++++++++++ tests/test/tchlp9.pp | 32 ++++++++++++++++++++++++++++++++ 33 files changed, 803 insertions(+) create mode 100644 tests/test/tchlp10.pp create mode 100644 tests/test/tchlp11.pp create mode 100644 tests/test/tchlp12.pp create mode 100644 tests/test/tchlp13.pp create mode 100644 tests/test/tchlp14.pp create mode 100644 tests/test/tchlp15.pp create mode 100644 tests/test/tchlp16.pp create mode 100644 tests/test/tchlp17.pp create mode 100644 tests/test/tchlp18.pp create mode 100644 tests/test/tchlp19.pp create mode 100644 tests/test/tchlp20.pp create mode 100644 tests/test/tchlp21.pp create mode 100644 tests/test/tchlp22.pp create mode 100644 tests/test/tchlp23.pp create mode 100644 tests/test/tchlp24.pp create mode 100644 tests/test/tchlp25.pp create mode 100644 tests/test/tchlp26.pp create mode 100644 tests/test/tchlp27.pp create mode 100644 tests/test/tchlp28.pp create mode 100644 tests/test/tchlp29.pp create mode 100644 tests/test/tchlp3.pp create mode 100644 tests/test/tchlp30.pp create mode 100644 tests/test/tchlp31.pp create mode 100644 tests/test/tchlp32.pp create mode 100644 tests/test/tchlp33.pp create mode 100644 tests/test/tchlp34.pp create mode 100644 tests/test/tchlp4.pp create mode 100644 tests/test/tchlp5.pp create mode 100644 tests/test/tchlp6.pp create mode 100644 tests/test/tchlp7.pp create mode 100644 tests/test/tchlp8.pp create mode 100644 tests/test/tchlp9.pp diff --git a/.gitattributes b/.gitattributes index b3a0eef60f..73125bb538 100644 --- a/.gitattributes +++ b/.gitattributes @@ -9279,9 +9279,41 @@ tests/test/tcase8.pp svneol=native#text/pascal tests/test/tcase9.pp svneol=native#text/pascal tests/test/tcg1.pp svneol=native#text/plain tests/test/tchlp1.pp svneol=native#text/pascal +tests/test/tchlp10.pp svneol=native#text/pascal +tests/test/tchlp11.pp svneol=native#text/pascal +tests/test/tchlp12.pp svneol=native#text/pascal +tests/test/tchlp13.pp svneol=native#text/pascal +tests/test/tchlp14.pp svneol=native#text/pascal +tests/test/tchlp15.pp svneol=native#text/pascal +tests/test/tchlp16.pp svneol=native#text/pascal +tests/test/tchlp17.pp svneol=native#text/pascal +tests/test/tchlp18.pp svneol=native#text/pascal +tests/test/tchlp19.pp svneol=native#text/pascal tests/test/tchlp2.pp svneol=native#text/pascal +tests/test/tchlp20.pp svneol=native#text/pascal +tests/test/tchlp21.pp svneol=native#text/pascal +tests/test/tchlp22.pp svneol=native#text/pascal +tests/test/tchlp23.pp svneol=native#text/pascal +tests/test/tchlp24.pp svneol=native#text/pascal +tests/test/tchlp25.pp svneol=native#text/pascal +tests/test/tchlp26.pp svneol=native#text/pascal +tests/test/tchlp27.pp svneol=native#text/pascal +tests/test/tchlp28.pp svneol=native#text/pascal +tests/test/tchlp29.pp svneol=native#text/pascal +tests/test/tchlp3.pp svneol=native#text/pascal +tests/test/tchlp30.pp svneol=native#text/pascal +tests/test/tchlp31.pp svneol=native#text/pascal +tests/test/tchlp32.pp svneol=native#text/pascal +tests/test/tchlp33.pp svneol=native#text/pascal +tests/test/tchlp34.pp svneol=native#text/pascal tests/test/tchlp35.pp svneol=native#text/pascal tests/test/tchlp36.pp svneol=native#text/pascal +tests/test/tchlp4.pp svneol=native#text/pascal +tests/test/tchlp5.pp svneol=native#text/pascal +tests/test/tchlp6.pp svneol=native#text/pascal +tests/test/tchlp7.pp svneol=native#text/pascal +tests/test/tchlp8.pp svneol=native#text/pascal +tests/test/tchlp9.pp svneol=native#text/pascal tests/test/tcint64.pp svneol=native#text/plain tests/test/tclass1.pp svneol=native#text/plain tests/test/tclass10.pp svneol=native#text/pascal diff --git a/tests/test/tchlp10.pp b/tests/test/tchlp10.pp new file mode 100644 index 0000000000..0bf9cddc28 --- /dev/null +++ b/tests/test/tchlp10.pp @@ -0,0 +1,25 @@ +{ %NORUN } + +{ first simple scope test for class helpers } +program tchlp10; + +{$ifdef fpc} + {$mode objfpc} +{$endif} + +type + TObjectHelper = class helper for TObject + procedure SomeMethod; + end; + +procedure TObjectHelper.SomeMethod; +begin + +end; + +var + o: TObject; +begin + o.SomeMethod; +end. + diff --git a/tests/test/tchlp11.pp b/tests/test/tchlp11.pp new file mode 100644 index 0000000000..51294268cc --- /dev/null +++ b/tests/test/tchlp11.pp @@ -0,0 +1,23 @@ +{ %NORUN } + +{ second simple scope test for class helpers } +program tchlp11; + +{$ifdef fpc} + {$mode objfpc} +{$endif} + +type + TObjectHelper = class helper for TObject + class procedure SomeMethod; + end; + +class procedure TObjectHelper.SomeMethod; +begin + +end; + +begin + TObject.SomeMethod; +end. + diff --git a/tests/test/tchlp12.pp b/tests/test/tchlp12.pp new file mode 100644 index 0000000000..1568885beb --- /dev/null +++ b/tests/test/tchlp12.pp @@ -0,0 +1,34 @@ +{ class helpers hide methods of the extended class } +program tchlp12; + +{$ifdef fpc} + {$mode objfpc} +{$endif} + +type + TFoo = class + function Test: Integer; + end; + + TFooHelper = class helper for TFoo + function Test: Integer; + end; + +function TFoo.Test: Integer; +begin + Result := 1; +end; + +function TFooHelper.Test: Integer; +begin + Result := 2; +end; + +var + f: TFoo; +begin + f := TFoo.Create; + if f.Test <> 2 then + Halt(1); +end. + diff --git a/tests/test/tchlp13.pp b/tests/test/tchlp13.pp new file mode 100644 index 0000000000..6a8a62286c --- /dev/null +++ b/tests/test/tchlp13.pp @@ -0,0 +1,43 @@ +{ class helpers don't hide methods of the subclasses of the extended class } +program tchlp13; + +{$ifdef fpc} + {$mode objfpc} +{$endif} + +type + TFoo = class + function Test: Integer; + end; + + TFooHelper = class helper for TFoo + function Test: Integer; + end; + + TFooSub = class(TFoo) + function Test: Integer; + end; + +function TFoo.Test: Integer; +begin + Result := 1; +end; + +function TFooHelper.Test: Integer; +begin + Result := 2; +end; + +function TFooSub.Test: Integer; +begin + Result := 3; +end; + +var + f: TFooSub; +begin + f := TFooSub.Create; + if f.Test <> 3 then + Halt(1); +end. + diff --git a/tests/test/tchlp14.pp b/tests/test/tchlp14.pp new file mode 100644 index 0000000000..a46ae857b3 --- /dev/null +++ b/tests/test/tchlp14.pp @@ -0,0 +1,32 @@ +{ %FAIL } + +{ class helpers must not override virtual methods of the extended class } +program tchlp14; + +{$ifdef fpc} + {$mode objfpc} +{$endif} + +type + TFoo = class + function Test: Integer; virtual; + end; + + TFooHelper = class helper for TFoo + function Test: Integer; override; + end; + +function TFoo.Test: Integer; +begin + Result := 1; +end; + +function TFooHelper.Test: Integer; +begin + Result := 2; +end; + +begin + +end. + diff --git a/tests/test/tchlp15.pp b/tests/test/tchlp15.pp new file mode 100644 index 0000000000..ee0e16f209 --- /dev/null +++ b/tests/test/tchlp15.pp @@ -0,0 +1,34 @@ +{ class helpers may hide virtual methods of the extended class } +program tchlp15; + +{$ifdef fpc} + {$mode objfpc} +{$endif} + +type + TFoo = class + function Test: Integer; virtual; + end; + + TFooHelper = class helper for TFoo + function Test: Integer; + end; + +function TFoo.Test: Integer; +begin + Result := 1; +end; + +function TFooHelper.Test: Integer; +begin + Result := 2; +end; + +var + f: TFoo; +begin + f := TFoo.Create; + if f.Test <> 2 then + Halt(1); +end. + diff --git a/tests/test/tchlp16.pp b/tests/test/tchlp16.pp new file mode 100644 index 0000000000..470690f3fc --- /dev/null +++ b/tests/test/tchlp16.pp @@ -0,0 +1,18 @@ +{ %FAIL } + +{ class helpers may not be referenced in any way - test 1 } +program tchlp16; + +{$ifdef fpc} + {$mode objfpc} +{$endif} + +type + TObjectHelper = class helper for TObject + end; + +var + o: TObjectHelper; +begin +end. + diff --git a/tests/test/tchlp17.pp b/tests/test/tchlp17.pp new file mode 100644 index 0000000000..4116ef47fe --- /dev/null +++ b/tests/test/tchlp17.pp @@ -0,0 +1,17 @@ +{ %FAIL } + +{ class helpers may not be referenced in any way - test 2 } +program tchlp17; + +{$ifdef fpc} + {$mode objfpc} +{$endif} + +type + TObjectHelper = class helper for TObject + end; + +begin + with TObjectHelper.Create do ; +end. + diff --git a/tests/test/tchlp18.pp b/tests/test/tchlp18.pp new file mode 100644 index 0000000000..9640d5b7c4 --- /dev/null +++ b/tests/test/tchlp18.pp @@ -0,0 +1,23 @@ +{ %FAIL } + +{ class helpers may not be referenced in any way - test 3 } +program tchlp18; + +{$ifdef fpc} + {$mode objfpc} +{$endif} + +type + TObjectHelper = class helper for TObject + class procedure Test; + end; + +class procedure TObjectHelper.Test; +begin + +end; + +begin + TObjectHelper.Test; +end. + diff --git a/tests/test/tchlp19.pp b/tests/test/tchlp19.pp new file mode 100644 index 0000000000..b63dde6b4a --- /dev/null +++ b/tests/test/tchlp19.pp @@ -0,0 +1,21 @@ +{ %FAIL } + +{ class helpers may not be referenced in any way - test 4 } +program tchlp19; + +{$ifdef fpc} + {$mode objfpc} +{$endif} + +type + TObjectHelper = class helper for TObject + end; + +procedure SomeProc(aHelper: TObjectHelper); +begin + +end; + +begin +end. + diff --git a/tests/test/tchlp20.pp b/tests/test/tchlp20.pp new file mode 100644 index 0000000000..a4359f9d3d --- /dev/null +++ b/tests/test/tchlp20.pp @@ -0,0 +1,20 @@ +{ %FAIL } + +{ class helpers may not be referenced in any way - test 5 } +program tchlp20; + +{$ifdef fpc} + {$mode objfpc} +{$endif} + +type + TObjectHelper = class helper for TObject + end; + + TSomeRec = record + helper: TObjectHelper; + end; + +begin +end. + diff --git a/tests/test/tchlp21.pp b/tests/test/tchlp21.pp new file mode 100644 index 0000000000..124c7d5daf --- /dev/null +++ b/tests/test/tchlp21.pp @@ -0,0 +1,19 @@ +{ %FAIL } + +{ class helpers may not be referenced in any way - test 6 } +program tchlp21; + +{$ifdef fpc} + {$mode objfpc} +{$endif} + +type + TObjectHelper = class helper for TObject + end; + + TObjectHelperHelper = class helper for TObjectHelper + end; + +begin +end. + diff --git a/tests/test/tchlp22.pp b/tests/test/tchlp22.pp new file mode 100644 index 0000000000..8774ebb19d --- /dev/null +++ b/tests/test/tchlp22.pp @@ -0,0 +1,35 @@ +{ %FAIL } + +{ in mode Delphi overloading isn't enabled by default } +program tchlp22; + +{$ifdef fpc} + {$mode delphi} +{$endif} + +type + TFoo = class + procedure Test(const aTest: String); + end; + + TFooHelper = class helper for TFoo + procedure Test; + end; + +procedure TFoo.Test(const aTest: String); +begin + +end; + +procedure TFooHelper.Test; +begin + +end; + +var + f: TFoo; +begin + f := TFoo.Create; + f.Test('Foo'); +end. + diff --git a/tests/test/tchlp23.pp b/tests/test/tchlp23.pp new file mode 100644 index 0000000000..98789980f3 --- /dev/null +++ b/tests/test/tchlp23.pp @@ -0,0 +1,32 @@ +{ in mode ObjFPC overloading is enabled by default } +program tchlp23; + +{$mode objfpc} + +type + TFoo = class + procedure Test(const aTest: String); + end; + + TFooHelper = class helper for TFoo + procedure Test; + end; + +procedure TFoo.Test(const aTest: String); +begin + +end; + +procedure TFooHelper.Test; +begin + +end; + +var + f: TFoo; +begin + f := TFoo.Create; + f.Test; + f.Test('Foo'); +end. + diff --git a/tests/test/tchlp24.pp b/tests/test/tchlp24.pp new file mode 100644 index 0000000000..077c7e88d0 --- /dev/null +++ b/tests/test/tchlp24.pp @@ -0,0 +1,19 @@ +{ %FAIL } + +{ class helpers may not be referenced in any way - test 7 } +program tchlp24; + +{$ifdef fpc} + {$mode objfpc} +{$endif} + +type + TObjectHelper = class helper for TObject + end; + + TObjectHelperSub = class(TObjectHelper) + end; + +begin +end. + diff --git a/tests/test/tchlp25.pp b/tests/test/tchlp25.pp new file mode 100644 index 0000000000..8553ec35d1 --- /dev/null +++ b/tests/test/tchlp25.pp @@ -0,0 +1,17 @@ +{ %FAIL } + +{ class helpers may not contain any fields } +program tchlp25; + +{$ifdef fpc} + {$mode objfpc} +{$endif} + +type + TObjectHelper = class helper for TObject + Test: Integer; + end; + +begin +end. + diff --git a/tests/test/tchlp26.pp b/tests/test/tchlp26.pp new file mode 100644 index 0000000000..3789ae2dee --- /dev/null +++ b/tests/test/tchlp26.pp @@ -0,0 +1,23 @@ +{ %FAIL } + +{ class helpers must extend the same class if inheriting } +program tchlp26; + +{$ifdef fpc} + {$mode objfpc} +{$endif} + +type + TObjectHelperA = class helper for TObject + end; + + TFoo = class + end; + + TObjectHelperB = class helper(TObjectHelperA) for TFoo + end; + +begin + +end. + diff --git a/tests/test/tchlp27.pp b/tests/test/tchlp27.pp new file mode 100644 index 0000000000..c5eace94fe --- /dev/null +++ b/tests/test/tchlp27.pp @@ -0,0 +1,21 @@ +{ extensive scoping test - test 1 } +program tchlp27; + +{$ifdef fpc} + {$mode objfpc} +{$endif} + +uses + uchlp27a, uchlp27b; + +var + f: TFoo; + res: Integer; +begin + f := TFoo.Create; + res := f.Test; + Writeln('f.Test: ', res); + if res <> 2 then + Halt(1); +end. + diff --git a/tests/test/tchlp28.pp b/tests/test/tchlp28.pp new file mode 100644 index 0000000000..5db8625eaa --- /dev/null +++ b/tests/test/tchlp28.pp @@ -0,0 +1,28 @@ +{ extensive scoping test - test 2 } +program tchlp28; + +{$ifdef fpc} + {$mode objfpc} +{$endif} + +uses + uchlp27a, uchlp27b, uchlp27c; + +var + f: TFoo; + b: TBar; + res: Integer; +begin + f := TBar.Create; + res := f.Test; + Writeln('f.Test: ', res); + if res <> 2 then + Halt(1); + + b := TBar.Create; + res := b.Test; + Writeln('b.Test: ', res); + if res <> 3 then + Halt(2); +end. + diff --git a/tests/test/tchlp29.pp b/tests/test/tchlp29.pp new file mode 100644 index 0000000000..636a483df0 --- /dev/null +++ b/tests/test/tchlp29.pp @@ -0,0 +1,28 @@ +{ extensive scoping test - test 3 } +program tchlp29; + +{$ifdef fpc} + {$mode objfpc} +{$endif} + +uses + uchlp27a, uchlp27c, uchlp27b; + +var + f: TFoo; + b: TBar; + res: Integer; +begin + f := TBar.Create; + res := f.Test; + Writeln('f.Test: ', res); + if res <> 2 then + Halt(1); + + b := TBar.Create; + res := b.Test; + Writeln('b.Test: ', res); + if res <> 3 then + Halt(2); +end. + diff --git a/tests/test/tchlp3.pp b/tests/test/tchlp3.pp new file mode 100644 index 0000000000..bf1f6f28f6 --- /dev/null +++ b/tests/test/tchlp3.pp @@ -0,0 +1,19 @@ +{%FAIL} + +{ forward declarations are not allowed } +program tchlp3; + +{$ifdef fpc} + {$mode objfpc} +{$endif} + +type + TObjectHelper = class helper for TObject; + + TObjectHelper = class helper for TObject + end; + +begin + +end. + diff --git a/tests/test/tchlp30.pp b/tests/test/tchlp30.pp new file mode 100644 index 0000000000..029ab41f3d --- /dev/null +++ b/tests/test/tchlp30.pp @@ -0,0 +1,21 @@ +{ extensive scoping test - test 4 } +program tchlp30; + +{$ifdef fpc} + {$mode objfpc} +{$endif} + +uses + uchlp27b, uchlp27a; + +var + f: TFoo; + res: Integer; +begin + f := TFoo.Create; + res := f.Test; + Writeln('f.Test: ', res); + if res <> 2 then + Halt(1); +end. + diff --git a/tests/test/tchlp31.pp b/tests/test/tchlp31.pp new file mode 100644 index 0000000000..b3b8cb741c --- /dev/null +++ b/tests/test/tchlp31.pp @@ -0,0 +1,21 @@ +{ extensive scoping test - test 5 } +program tchlp31; + +{$ifdef fpc} + {$mode objfpc} +{$endif} + +uses + uchlp27b, uchlp27c; + +var + b: TBar; + res: Integer; +begin + b := TBar.Create; + res := b.Test; + Writeln('b.Test: ', res); + if res <> 3 then + Halt(1); +end. + diff --git a/tests/test/tchlp32.pp b/tests/test/tchlp32.pp new file mode 100644 index 0000000000..e3dbd9d947 --- /dev/null +++ b/tests/test/tchlp32.pp @@ -0,0 +1,19 @@ +{ %FAIL } + +{ only the last available class helper for a class must be used - test 1 } +program tchlp32; + +{$ifdef fpc} + {$mode objfpc} +{$endif} + +uses + uchlp32a, uchlp32b, uchlp32c; + +var + f: TFoo; +begin + f := TFoo.Create; + f.Method1; +end. + diff --git a/tests/test/tchlp33.pp b/tests/test/tchlp33.pp new file mode 100644 index 0000000000..f95e85b268 --- /dev/null +++ b/tests/test/tchlp33.pp @@ -0,0 +1,21 @@ +{ only the last available class helper for a class must be used - test 2 } +program tchlp33; + +{$ifdef fpc} + {$mode objfpc} +{$endif} + +uses + uchlp33a, uchlp33c, uchlp33b; + +var + f: TFoo; + res: Integer; +begin + f := TFoo.Create; + res := f.Test; + Writeln('f.Test: ', res); + if res <> 1 then + Halt(1); +end. + diff --git a/tests/test/tchlp34.pp b/tests/test/tchlp34.pp new file mode 100644 index 0000000000..d5bf731c39 --- /dev/null +++ b/tests/test/tchlp34.pp @@ -0,0 +1,20 @@ +{ %FAIL } + +{ a class helper can only inherit from another class helper } +program tchlp34; + +{$ifdef fpc} + {$mode objfpc} +{$endif} + +type + TFoo = class + + end; + + TObjectHelper = class helper(TFoo) for TObject + end; + +begin +end. + diff --git a/tests/test/tchlp4.pp b/tests/test/tchlp4.pp new file mode 100644 index 0000000000..ffcdbf2a93 --- /dev/null +++ b/tests/test/tchlp4.pp @@ -0,0 +1,18 @@ +{%FAIL} + +{ destructors are not allowed } +program tchlp4; + +{$ifdef fpc} + {$mode objfpc} +{$endif} + +type + TObjectHelper = class helper for TObject + destructor Destroy; override; + end; + +begin + +end. + diff --git a/tests/test/tchlp5.pp b/tests/test/tchlp5.pp new file mode 100644 index 0000000000..17816ef369 --- /dev/null +++ b/tests/test/tchlp5.pp @@ -0,0 +1,18 @@ +{%FAIL} + +{ class destructors are not allowed } +program tchlp5; + +{$ifdef fpc} + {$mode objfpc} +{$endif} + +type + TObjectHelper = class helper for TObject + class destructor Destroy; override; + end; + +begin + +end. + diff --git a/tests/test/tchlp6.pp b/tests/test/tchlp6.pp new file mode 100644 index 0000000000..e8fac720ae --- /dev/null +++ b/tests/test/tchlp6.pp @@ -0,0 +1,27 @@ +{%NORUN} + +{ message methods are allowed in mode Delphi } +program tchlp6; + +{$ifdef fpc} + {$mode delphi} +{$endif} + +type + TMessage = record + ID: LongWord; + end; + + TObjectHelper = class helper for TObject + procedure SomeMessage(var aMessage: TMessage); message 42; + end; + +procedure TObjectHelper.SomeMessage(var aMessage: TMessage); +begin + +end; + +begin + +end. + diff --git a/tests/test/tchlp7.pp b/tests/test/tchlp7.pp new file mode 100644 index 0000000000..e950a7908f --- /dev/null +++ b/tests/test/tchlp7.pp @@ -0,0 +1,25 @@ +{%FAIL} + +{ message methods are not allowed in mode ObjFPC } +program tchlp7; + +{$mode objfpc} + +type + TMessage = record + ID: LongWord; + end; + + TObjectHelper = class helper for TObject + procedure SomeMessage(var aMessage: TMessage); message 42; + end; + +procedure TObjectHelper.SomeMessage(var aMessage: TMessage); +begin + +end; + +begin + +end. + diff --git a/tests/test/tchlp8.pp b/tests/test/tchlp8.pp new file mode 100644 index 0000000000..8be3bf43f7 --- /dev/null +++ b/tests/test/tchlp8.pp @@ -0,0 +1,18 @@ +{%FAIL} + +{ abstract methods are not allowed } +program tchlp8; + +{$ifdef fpc} + {$mode objfpc} +{$endif} + +type + TObjectHelper = class helper for TObject + procedure SomeMethod; virtual; abstract; + end; + +begin + +end. + diff --git a/tests/test/tchlp9.pp b/tests/test/tchlp9.pp new file mode 100644 index 0000000000..ad43dbba7f --- /dev/null +++ b/tests/test/tchlp9.pp @@ -0,0 +1,32 @@ +{%NORUN} + +{ class helper inheritance syntax } +program tchlp9; + +{$ifdef fpc} + {$mode objfpc} +{$endif} + +type + TObjectHelperA = class helper for TObject + procedure SomeMethodA; + end; + + TObjectHelperB = class helper(TObjectHelperA) for TObject + procedure SomeMethodB; + end; + +procedure TObjectHelperA.SomeMethodA; +begin + +end; + +procedure TObjectHelperB.SomeMethodB; +begin + +end; + +begin + +end. +