mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-17 12:39:25 +02:00
* use a file to test readln bug
This commit is contained in:
parent
db3d97c2dc
commit
05dae2fe14
@ -1,3 +1,5 @@
|
||||
var
|
||||
t : text;
|
||||
type tFoo = object
|
||||
a:integer;
|
||||
constructor Create;
|
||||
@ -12,7 +14,7 @@ end;
|
||||
|
||||
procedure tFoo.ReadA;
|
||||
begin
|
||||
write('a: '); Readln(a);
|
||||
write('a: '); Readln(t,a);
|
||||
end;
|
||||
|
||||
procedure tFoo.ShowA;
|
||||
@ -22,7 +24,16 @@ end;
|
||||
|
||||
var Foo:tFoo;
|
||||
begin
|
||||
|
||||
assign(t,'tbug772.txt');
|
||||
rewrite(t);
|
||||
writeln(t,'4');
|
||||
close(t);
|
||||
reset(t);
|
||||
Foo.Create;
|
||||
Foo.ReadA; {this leaves Foo.a untouched, but it should'nt}
|
||||
Foo.ShowA;
|
||||
end.
|
||||
if Foo.A<>4 then
|
||||
Halt(1);
|
||||
close(t);
|
||||
end.
|
Loading…
Reference in New Issue
Block a user