mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-13 17:59:27 +02:00
merge r17435 from cpstrnew branch by michael:
* Tests for typed constants git-svn-id: trunk@19110 -
This commit is contained in:
parent
1db610ecbd
commit
2fe59a676a
3
.gitattributes
vendored
3
.gitattributes
vendored
@ -9946,6 +9946,9 @@ tests/test/tcpstr5.pp svneol=native#text/plain
|
||||
tests/test/tcpstr6.pp svneol=native#text/plain
|
||||
tests/test/tcpstr7.pp svneol=native#text/plain
|
||||
tests/test/tcpstr8.pp svneol=native#text/pascal
|
||||
tests/test/tcptypedconst.pp svneol=native#text/plain
|
||||
tests/test/tcptypedconst2.pp svneol=native#text/plain
|
||||
tests/test/tcptypedconst3.pp svneol=native#text/plain
|
||||
tests/test/tcstring1.pp svneol=native#text/pascal
|
||||
tests/test/tcstring2.pp svneol=native#text/pascal
|
||||
tests/test/tdel1.pp svneol=native#text/plain
|
||||
|
29
tests/test/tcptypedconst.pp
Normal file
29
tests/test/tcptypedconst.pp
Normal file
@ -0,0 +1,29 @@
|
||||
{$CODEPAGE cp850}
|
||||
program tcptypedconst;
|
||||
|
||||
type
|
||||
Str_cp = string<1251>;
|
||||
Str_cp850 = string<850>;
|
||||
|
||||
procedure printcontent(p : Pointer; l: integer);
|
||||
var
|
||||
i : Integer;
|
||||
pb : PByte;
|
||||
begin
|
||||
writeln;
|
||||
pb := p;
|
||||
for i := 1 to l do begin
|
||||
writeln('s[',i,']= ',pb^);
|
||||
inc(pb);
|
||||
end;
|
||||
end;
|
||||
|
||||
const
|
||||
c : Str_cp = #163#165#167#174#181#224;
|
||||
c850 : Str_cp850 = #163#165#167#174#181#224;
|
||||
begin
|
||||
printcontent(@(c[1]),Length(c));
|
||||
printcontent(@(c850[1]),Length(c850));
|
||||
WriteLn(c);
|
||||
WriteLn(c850);
|
||||
end.
|
22
tests/test/tcptypedconst2.pp
Normal file
22
tests/test/tcptypedconst2.pp
Normal file
@ -0,0 +1,22 @@
|
||||
{$CODEPAGE cp437}
|
||||
program tcptypedconst2;
|
||||
|
||||
procedure printcontent(p : Pointer; l: integer);
|
||||
var
|
||||
i : Integer;
|
||||
pb : PByte;
|
||||
begin
|
||||
writeln;
|
||||
pb := p;
|
||||
for i := 1 to l do begin
|
||||
writeln('s[',i,']= ',pb^);
|
||||
inc(pb);
|
||||
end;
|
||||
end;
|
||||
|
||||
const
|
||||
CFrame = #1#1#2#2#3;
|
||||
P: String[Length(CFrame)] = CFrame;
|
||||
begin
|
||||
printcontent(@(P[1]),Length(p));
|
||||
end.
|
11
tests/test/tcptypedconst3.pp
Normal file
11
tests/test/tcptypedconst3.pp
Normal file
@ -0,0 +1,11 @@
|
||||
{$codepage cp866}
|
||||
program tcptypedconst3;
|
||||
const
|
||||
c : Char = '£';//= #163
|
||||
begin
|
||||
writeln(Ord(c));
|
||||
if (Ord(c) <> 163) then begin
|
||||
writeln('error');
|
||||
Halt(1);
|
||||
end;
|
||||
end.
|
Loading…
Reference in New Issue
Block a user