summaryrefslogtreecommitdiff
path: root/fpcsrc/tests/webtbs/tw5082.pp
blob: df90a12c6e85fcbefca21cf1127478103ec094ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
{ Source provided for Free Pascal Bug Report 5082 }
{ Submitted by "Martin Schreiber" on  2006-05-01 }
{ e-mail:  }
program storedfalse;
{$ifdef FPC}{$mode objfpc}{$h+}{$INTERFACES CORBA}{$endif}
{$ifdef mswindows}{$apptype console}{$endif}
uses
 {$ifdef FPC}{$ifdef linux}cthreads,{$endif}{$endif}
 sysutils,classes;

type
 ttestclass1 = class(tcomponent)
  private
   fprop1: real;
  public
   property prop1: real read fprop1 write fprop1 stored false;
 end;

 ttestclass2 = class(ttestclass1)
  published
   property prop1;
 end;

var
 testclass2: ttestclass2;
 stream1,stream2: tmemorystream;
 str1: string;

begin
 testclass2:= ttestclass2.create(nil);
 testclass2.prop1:= 1;
 stream1:= tmemorystream.create;
 try
  stream1.writecomponent(testclass2);
  stream2:= tmemorystream.create;
  try
   stream1.position:= 0;
   objectbinarytotext(stream1,stream2);
   stream2.position:= 0;
   setlength(str1,stream2.size);
   move(stream2.memory^,str1[1],length(str1));
   write(str1);
  finally
   stream2.free;
  end;
 finally
  stream1.free;
 end;
 if pos('prop1',str1)<>0 then
   begin
     writeln('error');
     halt(1);
   end;
end.