mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2026-02-04 09:54:48 +01:00
* new bugs
This commit is contained in:
parent
02482feeab
commit
b2a39bd32e
91
tests/webtbs/tw3595.pp
Normal file
91
tests/webtbs/tw3595.pp
Normal file
@ -0,0 +1,91 @@
|
||||
{ Source provided for Free Pascal Bug Report 3595 }
|
||||
{ Submitted by "Martin Schreiber" on 2005-01-24 }
|
||||
{ e-mail: }
|
||||
program project1;
|
||||
|
||||
{$ifdef FPC} {$mode objfpc}{$H+} {$endif}
|
||||
|
||||
uses
|
||||
Classes,sysutils;
|
||||
|
||||
type
|
||||
ttest = class(tcomponent)
|
||||
private
|
||||
fwstr: widestring;
|
||||
published
|
||||
property wstr: widestring read fwstr write fwstr;
|
||||
end;
|
||||
|
||||
const
|
||||
textfilename = 'test.txt';
|
||||
|
||||
var
|
||||
test1,test2: ttest;
|
||||
memstream: tmemorystream;
|
||||
filestream: tfilestream;
|
||||
|
||||
function widestringtocharinfo(const str: widestring): string;
|
||||
var
|
||||
int1: integer;
|
||||
begin
|
||||
result:= '';
|
||||
for int1:= 1 to length(str) do begin
|
||||
result:= result + '#' + inttostr(ord(str[int1]));
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
test1:= ttest.create(nil);
|
||||
test2:= ttest.create(nil);
|
||||
with test1 do begin
|
||||
setlength(fwstr,3);
|
||||
fwstr[1]:= widechar(255);
|
||||
fwstr[2]:= widechar(256);
|
||||
fwstr[3]:= widechar(257);
|
||||
fwstr:= fwstr + #0#1'abcde'#127#128#129;
|
||||
end;
|
||||
try
|
||||
filestream:= tfilestream.create(textfilename,fmopenread);
|
||||
memstream:= tmemorystream.create;
|
||||
try
|
||||
objecttexttobinary(filestream,memstream);
|
||||
writeln('objecttexttobinary OK');
|
||||
try
|
||||
memstream.position:= 0;
|
||||
memstream.readcomponent(test2);
|
||||
writeln('object reading OK');
|
||||
if test1.wstr = test2.wstr then begin
|
||||
writeln('data OK');
|
||||
end
|
||||
else begin
|
||||
writeln('data wrong. expected:');
|
||||
writeln(widestringtocharinfo(test1.wstr));
|
||||
writeln('actual:');
|
||||
writeln(widestringtocharinfo(test2.wstr));
|
||||
end;
|
||||
except
|
||||
on e: exception do begin
|
||||
writeln('object reading fails: '+ e.message);
|
||||
end;
|
||||
end;
|
||||
except
|
||||
on e: exception do begin
|
||||
writeln('objecttexttobinary fails: '+e.message);
|
||||
end;
|
||||
end;
|
||||
filestream.free;
|
||||
memstream.free;
|
||||
except
|
||||
writeln('file '+textfilename+' not found.');
|
||||
end;
|
||||
filestream:= tfilestream.create(textfilename,fmcreate);
|
||||
memstream:= tmemorystream.create;
|
||||
memstream.writecomponent(test1);
|
||||
memstream.position:= 0;
|
||||
objectbinarytotext(memstream,filestream);
|
||||
memstream.free;
|
||||
filestream.free;
|
||||
test1.free;
|
||||
test2.free;
|
||||
end.
|
||||
|
||||
26
tests/webtbs/tw3716.pp
Normal file
26
tests/webtbs/tw3716.pp
Normal file
@ -0,0 +1,26 @@
|
||||
{ Source provided for Free Pascal Bug Report 3716 }
|
||||
{ Submitted by "Marc Weustink" on 2005-03-01 }
|
||||
{ e-mail: marc@freepascal.org }
|
||||
program protect;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
Classes;
|
||||
|
||||
type
|
||||
TMyClass = class(TObject)
|
||||
public
|
||||
procedure p;
|
||||
end;
|
||||
|
||||
procedure TMyClass.p;
|
||||
var
|
||||
C: TCollection;
|
||||
begin
|
||||
C.PropName;
|
||||
end;
|
||||
|
||||
begin
|
||||
end.
|
||||
|
||||
23
tests/webtbs/tw3719.pp
Normal file
23
tests/webtbs/tw3719.pp
Normal file
@ -0,0 +1,23 @@
|
||||
{ Source provided for Free Pascal Bug Report 3719 }
|
||||
{ Submitted by "Markus Beth" on 2005-03-01 }
|
||||
{ e-mail: markus.beth@zkrd.de }
|
||||
|
||||
{$ifdef fpc}{$mode delphi}{$endif}
|
||||
|
||||
uses
|
||||
Classes;
|
||||
|
||||
begin
|
||||
with TStringList.Create do try
|
||||
Delimiter := ' ';
|
||||
QuoteChar := #0;
|
||||
Add('1');
|
||||
Add('2');
|
||||
WriteLn(DelimitedText);
|
||||
if DelimitedText<>'1 2' then
|
||||
halt(1);
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
end.
|
||||
|
||||
60
tests/webtbs/tw3758.pp
Normal file
60
tests/webtbs/tw3758.pp
Normal file
@ -0,0 +1,60 @@
|
||||
{ Source provided for Free Pascal Bug Report 3758 }
|
||||
{ Submitted by "Martin Schreiber" on 2005-03-07 }
|
||||
{ e-mail: }
|
||||
program project1;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
Classes, SysUtils;
|
||||
|
||||
type
|
||||
|
||||
ttestcomp = class(tcomponent)
|
||||
private
|
||||
fwstr: widestring;
|
||||
published
|
||||
property wstr: widestring read fwstr write fwstr;
|
||||
end;
|
||||
|
||||
var
|
||||
stream1,stream2: tmemorystream;
|
||||
f: tfilestream;
|
||||
testcomp1,testcomp2: ttestcomp;
|
||||
str1: widestring;
|
||||
|
||||
begin
|
||||
setlength(str1,2);
|
||||
str1[1]:= widechar($1f00);
|
||||
str1[2]:= widechar($203);
|
||||
stream1:= tmemorystream.create;
|
||||
stream2:= tmemorystream.create;
|
||||
testcomp1:= ttestcomp.create(nil);
|
||||
testcomp2:= ttestcomp.create(nil);
|
||||
try
|
||||
testcomp1.wstr:= str1;
|
||||
stream1.writecomponent(testcomp1);
|
||||
stream1.position:= 0;
|
||||
objectbinarytotext(stream1,stream2);
|
||||
stream1.clear;
|
||||
stream2.position:= 0;
|
||||
f:= tfilestream.create('test.txt',fmcreate);
|
||||
f.copyfrom(stream2,0);
|
||||
f.free;
|
||||
stream2.position:= 0;
|
||||
objecttexttobinary(stream2,stream1);
|
||||
stream1.position:= 0;
|
||||
stream1.readcomponent(testcomp2);
|
||||
if testcomp2.wstr = str1 then begin
|
||||
writeln('OK');
|
||||
end
|
||||
else begin
|
||||
writeln('Error');
|
||||
end;
|
||||
finally
|
||||
stream1.free;
|
||||
stream2.free;
|
||||
testcomp1.free;
|
||||
testcomp2.free;
|
||||
end;
|
||||
end.
|
||||
Loading…
Reference in New Issue
Block a user