From 2fe59a676a9dc14bdd9ccfb156f9005c6fc30c01 Mon Sep 17 00:00:00 2001
From: paul <paul@idefix.freepascal.org>
Date: Sat, 17 Sep 2011 13:22:16 +0000
Subject: [PATCH] merge r17435 from cpstrnew branch by michael: * Tests for
 typed constants

git-svn-id: trunk@19110 -
---
 .gitattributes               |  3 +++
 tests/test/tcptypedconst.pp  | 29 +++++++++++++++++++++++++++++
 tests/test/tcptypedconst2.pp | 22 ++++++++++++++++++++++
 tests/test/tcptypedconst3.pp | 11 +++++++++++
 4 files changed, 65 insertions(+)
 create mode 100644 tests/test/tcptypedconst.pp
 create mode 100644 tests/test/tcptypedconst2.pp
 create mode 100644 tests/test/tcptypedconst3.pp

diff --git a/.gitattributes b/.gitattributes
index 317aa37531..010fb36cc6 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -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
diff --git a/tests/test/tcptypedconst.pp b/tests/test/tcptypedconst.pp
new file mode 100644
index 0000000000..7948d8a27c
--- /dev/null
+++ b/tests/test/tcptypedconst.pp
@@ -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.
diff --git a/tests/test/tcptypedconst2.pp b/tests/test/tcptypedconst2.pp
new file mode 100644
index 0000000000..ab0966c63e
--- /dev/null
+++ b/tests/test/tcptypedconst2.pp
@@ -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.
\ No newline at end of file
diff --git a/tests/test/tcptypedconst3.pp b/tests/test/tcptypedconst3.pp
new file mode 100644
index 0000000000..176486e8bd
--- /dev/null
+++ b/tests/test/tcptypedconst3.pp
@@ -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.
\ No newline at end of file