tcpstrconcatmulti.pp 733 B

12345678910111213141516171819202122232425262728293031323334353637
  1. {$APPTYPE CONSOLE}
  2. // test "fpc_AnsiStr_Concat_multi" with a same type(same encoding)
  3. uses
  4. {$ifdef unix}
  5. cwstring,
  6. {$endif unix}
  7. SysUtils;
  8. type
  9. ts866 = type string<866>;
  10. var
  11. a, b, c, d : ts866;
  12. begin
  13. a := 'al';
  14. b := 'b2';
  15. c := 'c3';
  16. //without "DestS" in the array
  17. d := a + b + c;
  18. if (StringCodePage(d) <> 866) then
  19. halt(1);
  20. //with empty "DestS" in the array
  21. d := '';
  22. d := d + a + b + c;
  23. if (StringCodePage(d) <> 866) then
  24. halt(2);
  25. //with "DestS" in the array at the start
  26. d := d + b + c;
  27. if (StringCodePage(d) <> 866) then
  28. halt(3);
  29. //with "DestS" in the array, not at the start
  30. d := a + b + d + c;
  31. if (StringCodePage(d) <> 866) then
  32. halt(4);
  33. WriteLn('ok');
  34. end.