Browse Source

+ some more property assignment tests (which already/still work)

git-svn-id: trunk@7487 -
Jonas Maebe 18 years ago
parent
commit
f12428506e
2 changed files with 60 additions and 0 deletions
  1. 1 0
      .gitattributes
  2. 59 0
      tests/test/tprop.pp

+ 1 - 0
.gitattributes

@@ -6929,6 +6929,7 @@ tests/test/tprocext.pp svneol=native#text/plain
 tests/test/tprocvar1.pp svneol=native#text/plain
 tests/test/tprocvar1.pp svneol=native#text/plain
 tests/test/tprocvar2.pp svneol=native#text/plain
 tests/test/tprocvar2.pp svneol=native#text/plain
 tests/test/tprocvar3.pp svneol=native#text/plain
 tests/test/tprocvar3.pp svneol=native#text/plain
+tests/test/tprop.pp svneol=native#text/plain
 tests/test/tprop1.pp svneol=native#text/plain
 tests/test/tprop1.pp svneol=native#text/plain
 tests/test/tprop2.pp svneol=native#text/plain
 tests/test/tprop2.pp svneol=native#text/plain
 tests/test/trange1.pp svneol=native#text/plain
 tests/test/trange1.pp svneol=native#text/plain

+ 59 - 0
tests/test/tprop.pp

@@ -0,0 +1,59 @@
+{$ifdef fpc}
+{$mode delphi}
+{$endif}
+
+uses
+  variants;
+
+type
+  tdynarr = array of byte;
+
+  tc = class
+   private
+    fda: tdynarr;
+    fva: variant;
+   public
+    property da: tdynarr read fda write fda;
+    property va: variant read fva write fva;
+  end;
+
+var
+  c: tc;
+  v: variant;
+  d: tdynarr;
+begin
+  c:=tc.create;
+
+  v:=5;
+  c.va:=v;
+  if (c.fva <> 5) then
+    halt(1);
+  v:='abc';
+  v:=c.va;
+  if (v <> 5) then
+    halt(2);
+
+  setlength(d,4);
+  d[0]:=245;
+  d[1]:=1;
+  d[2]:=38;
+  d[3]:=115;
+  c.da:=d;
+  if (length(c.fda)<>4) or
+     (c.fda[0]<>245) or
+     (c.fda[1]<>1) or
+     (c.fda[2]<>38) or
+     (c.fda[3]<>115) then
+    halt(3);
+  d:=nil;
+  d:=c.da;
+  c.fda:=nil;
+  if (length(d)<>4) or
+     (d[0]<>245) or
+     (d[1]<>1) or
+     (d[2]<>38) or
+     (d[3]<>115) then
+    halt(4);
+  
+  c.free;
+end.