Browse Source

merge r13482 from cpstrnew branch by florian:
+ first tests for code page aware strings

git-svn-id: trunk@19081 -

paul 14 years ago
parent
commit
42832675d8
6 changed files with 82 additions and 0 deletions
  1. 5 0
      .gitattributes
  2. 30 0
      tests/test/tcpstr1.pp
  3. 12 0
      tests/test/tcpstr2.pp
  4. 13 0
      tests/test/tcpstr2a.pp
  5. 11 0
      tests/test/tcpstr3.pp
  6. 11 0
      tests/test/tcpstr4.pp

+ 5 - 0
.gitattributes

@@ -9936,6 +9936,11 @@ tests/test/tconstref1.pp svneol=native#text/pascal
 tests/test/tconstref2.pp svneol=native#text/pascal
 tests/test/tconstref3.pp svneol=native#text/pascal
 tests/test/tconstref4.pp svneol=native#text/pascal
+tests/test/tcpstr1.pp svneol=native#text/plain
+tests/test/tcpstr2.pp svneol=native#text/plain
+tests/test/tcpstr2a.pp svneol=native#text/plain
+tests/test/tcpstr3.pp svneol=native#text/plain
+tests/test/tcpstr4.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

+ 30 - 0
tests/test/tcpstr1.pp

@@ -0,0 +1,30 @@
+type
+  tcpstr437 = string<437>;
+  tcpstr850 = string<850>;
+var
+  a1 : tcpstr437;
+  a2 : utf8string;
+  a3 : tcpstr850;
+  u1 : unicodestring;
+begin
+  a1:=#132;
+  a2:=a1;
+  if ord(a2[1])<>195 then
+    halt(1);
+  if ord(a2[2])<>164 then
+    halt(1);
+
+  writeln('---');
+
+  a3:=a1;
+  if ord(a3[1])<>132 then
+    halt(1);
+
+  writeln('---');
+
+  u1:=a1;
+  if ord(u1[1])<>228 then
+    halt(1);
+
+  writeln('ok');
+end.

+ 12 - 0
tests/test/tcpstr2.pp

@@ -0,0 +1,12 @@
+procedure p(const S : RawByteString); overload;
+  begin
+  end;
+
+procedure p(const S : UTF8String); overload;
+  begin
+  end;
+var
+  s1 : RawByteString;
+begin
+  p(s1);
+end.

+ 13 - 0
tests/test/tcpstr2a.pp

@@ -0,0 +1,13 @@
+{ %fail }
+procedure p(const S : RawByteString); overload;
+  begin
+  end;
+
+procedure p(const S : UTF8String); overload;
+  begin
+  end;
+var
+  s1 : Ansistring;
+begin
+  p(s1);
+end.

+ 11 - 0
tests/test/tcpstr3.pp

@@ -0,0 +1,11 @@
+{ %fail }
+procedure p(var S : RawByteString);
+  begin
+  end;
+
+var
+  s1 : ansistring;
+
+begin
+  p(s1);
+end.

+ 11 - 0
tests/test/tcpstr4.pp

@@ -0,0 +1,11 @@
+{ %fail }
+procedure p(var S : RawByteString);
+  begin
+  end;
+
+var
+  s1 : UTF8String;
+
+begin
+  p(s1);
+end.