mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-03 20:57:22 +01:00
tests: add test to check overload precedence for AnsiString type passed to other string types
git-svn-id: trunk@21191 -
This commit is contained in:
parent
50ddd16619
commit
548cdece84
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -10483,6 +10483,7 @@ tests/test/tcpstr2.pp svneol=native#text/plain
|
|||||||
tests/test/tcpstr20.pp svneol=native#text/pascal
|
tests/test/tcpstr20.pp svneol=native#text/pascal
|
||||||
tests/test/tcpstr21.pp svneol=native#text/pascal
|
tests/test/tcpstr21.pp svneol=native#text/pascal
|
||||||
tests/test/tcpstr21a.pp svneol=native#text/pascal
|
tests/test/tcpstr21a.pp svneol=native#text/pascal
|
||||||
|
tests/test/tcpstr22.pp svneol=native#text/pascal
|
||||||
tests/test/tcpstr2a.pp svneol=native#text/plain
|
tests/test/tcpstr2a.pp svneol=native#text/plain
|
||||||
tests/test/tcpstr3.pp svneol=native#text/plain
|
tests/test/tcpstr3.pp svneol=native#text/plain
|
||||||
tests/test/tcpstr4.pp svneol=native#text/plain
|
tests/test/tcpstr4.pp svneol=native#text/plain
|
||||||
|
|||||||
@ -12,10 +12,12 @@ program tcpstr21;
|
|||||||
procedure TestStrConst1(const S: UnicodeString); overload;
|
procedure TestStrConst1(const S: UnicodeString); overload;
|
||||||
begin
|
begin
|
||||||
end;
|
end;
|
||||||
|
{$ifndef FPC_WIDESTRING_EQUAL_UNICODESTRING}
|
||||||
procedure TestStrConst1(const S: WideString); overload;
|
procedure TestStrConst1(const S: WideString); overload;
|
||||||
begin
|
begin
|
||||||
halt(1);
|
halt(1);
|
||||||
end;
|
end;
|
||||||
|
{$endif}
|
||||||
procedure TestStrConst1(const S: PWideChar); overload;
|
procedure TestStrConst1(const S: PWideChar); overload;
|
||||||
begin
|
begin
|
||||||
halt(1);
|
halt(1);
|
||||||
|
|||||||
99
tests/test/tcpstr22.pp
Normal file
99
tests/test/tcpstr22.pp
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
program tcpstr22;
|
||||||
|
|
||||||
|
{$MODE DELPHI}
|
||||||
|
|
||||||
|
type
|
||||||
|
cp1253string = type AnsiString(1253);
|
||||||
|
|
||||||
|
// --- all string types ---
|
||||||
|
procedure test_overload1(const s: AnsiString); overload;
|
||||||
|
begin
|
||||||
|
end;
|
||||||
|
procedure test_overload1(const s: UTF8String); overload;
|
||||||
|
begin
|
||||||
|
halt(1);
|
||||||
|
end;
|
||||||
|
procedure test_overload1(const s: cp1253string); overload;
|
||||||
|
begin
|
||||||
|
halt(1);
|
||||||
|
end;
|
||||||
|
procedure test_overload1(const s: unicodestring); overload;
|
||||||
|
begin
|
||||||
|
halt(1);
|
||||||
|
end;
|
||||||
|
procedure test_overload1(const s: widestring); overload;
|
||||||
|
begin
|
||||||
|
halt(1);
|
||||||
|
end;
|
||||||
|
procedure test_overload1(const s: ShortString); overload;
|
||||||
|
begin
|
||||||
|
halt(1);
|
||||||
|
end;
|
||||||
|
// --- no AnsiString ---
|
||||||
|
procedure test_overload2(const s: UTF8String); overload;
|
||||||
|
begin
|
||||||
|
end;
|
||||||
|
procedure test_overload2(const s: cp1253string); overload;
|
||||||
|
begin
|
||||||
|
halt(2);
|
||||||
|
end;
|
||||||
|
procedure test_overload2(const s: unicodestring); overload;
|
||||||
|
begin
|
||||||
|
halt(2);
|
||||||
|
end;
|
||||||
|
procedure test_overload2(const s: widestring); overload;
|
||||||
|
begin
|
||||||
|
halt(2);
|
||||||
|
end;
|
||||||
|
procedure test_overload2(const s: ShortString); overload;
|
||||||
|
begin
|
||||||
|
halt(2);
|
||||||
|
end;
|
||||||
|
// --- no AnsiString, UTF8String ---
|
||||||
|
procedure test_overload3(const s: cp1253string); overload;
|
||||||
|
begin
|
||||||
|
end;
|
||||||
|
procedure test_overload3(const s: unicodestring); overload;
|
||||||
|
begin
|
||||||
|
halt(3);
|
||||||
|
end;
|
||||||
|
procedure test_overload3(const s: widestring); overload;
|
||||||
|
begin
|
||||||
|
halt(3);
|
||||||
|
end;
|
||||||
|
procedure test_overload3(const s: ShortString); overload;
|
||||||
|
begin
|
||||||
|
halt(3);
|
||||||
|
end;
|
||||||
|
// --- no AnsiString, UTF8String, AnsiString(codepage) ---
|
||||||
|
procedure test_overload4(const s: unicodestring); overload;
|
||||||
|
begin
|
||||||
|
end;
|
||||||
|
{ifndef FPC_WIDESTRING_EQUAL_UNICODESTRING}
|
||||||
|
procedure test_overload4(const s: widestring); overload;
|
||||||
|
begin
|
||||||
|
halt(4);
|
||||||
|
end;
|
||||||
|
{$endif}
|
||||||
|
procedure test_overload4(const s: ShortString); overload;
|
||||||
|
begin
|
||||||
|
halt(4);
|
||||||
|
end;
|
||||||
|
// --- no AnsiString, UTF8String, AnsiString(codepage), UnicodeString ---
|
||||||
|
procedure test_overload5(const s: widestring); overload;
|
||||||
|
begin
|
||||||
|
end;
|
||||||
|
procedure test_overload5(const s: ShortString); overload;
|
||||||
|
begin
|
||||||
|
halt(5);
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
A: AnsiString;
|
||||||
|
begin
|
||||||
|
test_overload1(A);
|
||||||
|
test_overload2(A);
|
||||||
|
test_overload3(A);
|
||||||
|
test_overload4(A);
|
||||||
|
test_overload5(A);
|
||||||
|
end.
|
||||||
Loading…
Reference in New Issue
Block a user