FpDebug: tests

git-svn-id: trunk@63886 -
This commit is contained in:
martin 2020-09-17 23:04:20 +00:00
parent 47bbc252d8
commit b3cbbc6218
3 changed files with 40 additions and 5 deletions

View File

@ -1131,6 +1131,17 @@ begin
//t.CheckResults;
//exit;
t.Add('U8Data1', weAnsiStr(''''#$E2#$89#$A7'''', 'Utf8String'))
//t.Add('U8Data1', weAnsiStr(''''#$2267'''', 'Utf8String'))
.NoCharQuoting
.IgnTypeName.IgnKind
.skipIf(Compiler.Version < 030000);
t.Add('U8Data2', weAnsiStr(''''#$E2#$89#$A7'X''', 'Utf8String'))
//t.Add('U8Data2', weAnsiStr(''''#$2267'X''', 'Utf8String'))
.NoCharQuoting
.IgnTypeName.IgnKind
.skipIf(Compiler.Version < 030000);
t.Add('SomeFunc1', weMatch('^function *\(SOMEVALUE, Foo: LONGINT; Bar: Word; x: Byte\): *BOOLEAN *AT *\$[0-9A-F]+', skFunction) );
t.Add('SomeProc1', weMatch('^procedure *\(\) *AT *\$[0-9A-F]+', skProcedure) );
t.Add('@SomeFunc1', weMatch('^\^function.*\(\$[0-9A-F]+\)'{' = SomeFunc1'}, skPointer {skFunctionRef}) );

View File

@ -320,6 +320,8 @@ var
MyStringItemList: TMyStringItemListShort;
MyStringList: TMyStringList;
U8Data1, U8Data2: Utf8String;
{$if FPC_FULLVERSION >= 30000}
dummy1: PFuncSelfRef;
{$ENDIF}
@ -466,6 +468,8 @@ begin // TEST_BREAKPOINT=FooConstRefBegin
end;
begin
U8Data1 := #$2267; //#$E2#$89#$A7;
U8Data2 := #$2267'X';
// access constant that are not passed as function arg
// so every constant is accessed, and they can not be optimized away
InterfacedObject:= TInterfacedObject.create;

View File

@ -32,6 +32,7 @@ type
ehMatchTypeName, // The typename is a regex
ehNoTypeInfo,
ehNoCharQuoting, // unprintable chars are already escaped/quoted
ehCharFromIndex, // Debugger is allowed Pchar: 'x' String 'y'
ehNoFieldOrder, // structure: fields can be in any order
ehMissingFields, // structure: fields may have gaps
@ -171,6 +172,7 @@ type
function IgnTypeName(ASymTypes: TSymbolTypes = []; ACond: Boolean = True): PWatchExpectation;
function MatchTypeName(ASymTypes: TSymbolTypes = []; ACond: Boolean = True): PWatchExpectation;
function NoCharQuoting(ASymTypes: TSymbolTypes = []; ACond: Boolean = True): PWatchExpectation;
function CharFromIndex(ASymTypes: TSymbolTypes = []; ACond: Boolean = True): PWatchExpectation;
function ExpectNotFound(ASymTypes: TSymbolTypes = []; ACond: Boolean = True): PWatchExpectation;
@ -993,6 +995,13 @@ begin
Result := Self^.AddFlag(ehMatchTypeName, ASymTypes);
end;
function TWatchExpectationHelper.NoCharQuoting(ASymTypes: TSymbolTypes;
ACond: Boolean): PWatchExpectation;
begin
if not ACond then exit(Self);
Result := Self^.AddFlag(ehNoCharQuoting, ASymTypes);
end;
function TWatchExpectationHelper.CharFromIndex(ASymTypes: TSymbolTypes; ACond: Boolean): PWatchExpectation;
begin
if not ACond then exit(Self);
@ -1570,10 +1579,13 @@ begin
with AContext.WatchExp do begin
Result := True;
Expect := AContext.Expectation;
e := QuoteText(Expect.ExpTextData);
ehf := Expect.ExpErrorHandlingFlags[Compiler.SymbolType];
if ehNoCharQuoting in ehf then
e := Expect.ExpTextData
else
e := QuoteText(Expect.ExpTextData);
if ehCharFromIndex in ehf then begin
if AContext.WatchVal.Value <> e then begin
//AnIgnoreRsn := AnIgnoreRsn + 'char from index not implemented';
@ -1633,7 +1645,10 @@ begin
end;
end;
e := QuoteText(Expect.ExpTextData);
if ehNoCharQuoting in ehf then
e := Expect.ExpTextData
else
e := QuoteText(Expect.ExpTextData);
Result := TestEquals('Data', e, v, AContext, AnIgnoreRsn);
end;
end;
@ -1643,11 +1658,16 @@ function TWatchExpectationList.CheckResultShortStr(
var
Expect: TWatchExpectationResult;
e: String;
ehf: TWatchExpErrorHandlingFlags;
begin
with AContext.WatchExp do begin
Result := True;
Expect := AContext.Expectation;
e := QuoteText(Expect.ExpTextData);
ehf := Expect.ExpErrorHandlingFlags[Compiler.SymbolType];
if ehNoCharQuoting in ehf then
e := Expect.ExpTextData
else
e := QuoteText(Expect.ExpTextData);
Result := TestEquals('Data', e, AContext.WatchVal.Value, AContext, AnIgnoreRsn);
end;