2
0
Эх сурвалжийг харах

tests: more tests for classes

git-svn-id: trunk@14611 -
paul 15 жил өмнө
parent
commit
67ce65eb35

+ 1 - 0
.gitattributes

@@ -9233,6 +9233,7 @@ tests/test/tstatic1.pp svneol=native#text/pascal
 tests/test/tstatic2.pp svneol=native#text/pascal
 tests/test/tstatic3.pp svneol=native#text/pascal
 tests/test/tstatic4.pp svneol=native#text/pascal
+tests/test/tstatic5.pp svneol=native#text/pascal
 tests/test/tstprocv.pp svneol=native#text/plain
 tests/test/tstring1.pp svneol=native#text/plain
 tests/test/tstring10.pp svneol=native#text/plain

+ 4 - 1
tests/test/tclass12c.pp

@@ -11,8 +11,11 @@ type
       PrivateConst = 1;
     type
       PrivateType = type Integer;
+    var
+      FPrivateField: PrivateType;
   public
     procedure DoSomething(Value: PrivateType = PrivateConst);
+    property SomeProp: PrivateType read FPrivateField write FPrivateField default PrivateConst;
   end;
 
   procedure TSomeClass.DoSomething(Value: PrivateType = PrivateConst);
@@ -20,4 +23,4 @@ type
   end;
 
 begin
-end.
+end.

+ 37 - 0
tests/test/tstatic5.pp

@@ -0,0 +1,37 @@
+program tstatic5;
+{$APPTYPE console}
+{$ifdef fpc}
+  {$mode delphi}{$H+}
+{$endif}
+
+type
+
+  { TSomeClass }
+
+  TSomeClass = class
+  public
+    class var
+      FSomethingStatic: Integer;
+      FSomethingStatic1: String;
+    class procedure SetSomethingStatic(AValue: Integer); static;
+    var
+      FSomeRegularField: Integer;
+      FSomeRegularField1: String;
+    class var
+      FSomethingStatic2: byte;
+    class property SomethingStatic: Integer read FSomethingStatic write SetSomethingStatic;
+    class property SomethingStatic1: String read FSomethingStatic1 write FSomethingStatic1;
+    class property SomethingStatic2: byte read FSomethingStatic2 write FSomethingStatic2;
+    property SomethingRegular: Integer read FSomeRegularField write FSomeRegularField;
+    property SomethingRegular1: String read FSomeRegularField1 write FSomeRegularField1;
+  end;
+
+{ TSomeClass }
+
+class procedure TSomeClass.SetSomethingStatic(AValue: Integer);
+begin
+  FSomethingStatic := AValue;
+end;
+
+begin
+end.