merge r17435 from cpstrnew branch by michael:

* Tests for typed constants

git-svn-id: trunk@19110 -
This commit is contained in:
paul 2011-09-17 13:22:16 +00:00
parent 1db610ecbd
commit 2fe59a676a
4 changed files with 65 additions and 0 deletions

3
.gitattributes vendored
View File

@ -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

View 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.

View 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.

View 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.