Browse Source

* forgot to commit, part of r21765

git-svn-id: trunk@21766 -
Jonas Maebe 13 years ago
parent
commit
3f5ae8b05f
2 changed files with 32 additions and 0 deletions
  1. 1 0
      .gitattributes
  2. 31 0
      tests/test/jvm/tsetansistr.pp

+ 1 - 0
.gitattributes

@@ -10196,6 +10196,7 @@ tests/test/jvm/trange3.pp svneol=native#text/plain
 tests/test/jvm/tset1.pp svneol=native#text/plain
 tests/test/jvm/tset3.pp svneol=native#text/plain
 tests/test/jvm/tset7.pp svneol=native#text/plain
+tests/test/jvm/tsetansistr.pp -text svneol=native#text/plain
 tests/test/jvm/tstr.pp svneol=native#text/plain
 tests/test/jvm/tstring1.pp svneol=native#text/plain
 tests/test/jvm/tstring9.pp svneol=native#text/plain

+ 31 - 0
tests/test/jvm/tsetansistr.pp

@@ -0,0 +1,31 @@
+program tsetansistr;
+
+{$mode delphi}
+{$modeswitch unicodestrings}
+
+type
+  ByteArray = array of byte;
+
+const
+  AnsiStrOffset = 1;
+
+function AnsiStringOfBytes(const Src : ByteArray) : AnsiString;
+var
+ i : integer;
+begin
+ SetLength(Result, Length(Src));
+
+ for i := 0 to Length(Src) - 1 do
+   Result[i + AnsiStrOffset] := Chr(Src[i]);
+end;
+
+var
+ A : ByteArray;
+ B : AnsiString;
+begin
+ DefaultSystemCodePage:=20127; // ASCII
+ SetLength(A, 1); A[0] := $98;
+ B := AnsiStringOfBytes(A);
+ if ord(B[1]) <> $98 then
+   halt(1);
+end.