IdeDebugger: fix rpfClearMultiLine / amend test for new settings

This commit is contained in:
Martin 2024-09-13 18:07:59 +02:00
parent 71f0514fa4
commit 4621061aae
2 changed files with 28 additions and 20 deletions

View File

@ -379,6 +379,9 @@ operator := (a:pointer): TWatchExpectationResult;
implementation implementation
var
TestWatchDisplayFormat: TWatchDisplayFormat;
operator := (a:string): TWatchExpectationResult; operator := (a:string): TWatchExpectationResult;
begin begin
Result := weAnsiStr(a); Result := weAnsiStr(a);
@ -1477,7 +1480,7 @@ begin
Context.WatchRes := WatchVal.ResultData; Context.WatchRes := WatchVal.ResultData;
//debugln([' ## ## ', WatchVal.Expression]); //debugln([' ## ## ', WatchVal.Expression]);
//debugln([FWatchResultPrinter.PrintWatchValue(WatchVal.ResultData,DefaultWatchDisplayFormat)]); debugln; //debugln([FWatchResultPrinter.PrintWatchValue(WatchVal.ResultData,TestWatchDisplayFormat)]); debugln;
if (Context.WatchRes <> nil) and if (Context.WatchRes <> nil) and
(Context.WatchRes.ValueKind = rdkPCharOrString) (Context.WatchRes.ValueKind = rdkPCharOrString)
@ -1748,7 +1751,7 @@ begin
Result := True; Result := True;
Expect := AContext.Expectation; Expect := AContext.Expectation;
Result := TestMatches('Data', Expect.ExpTextData, FWatchResultPrinter.PrintWatchValue(AContext.WatchRes, DefaultWatchDisplayFormat, ''), AContext, AnIgnoreRsn); Result := TestMatches('Data', Expect.ExpTextData, FWatchResultPrinter.PrintWatchValue(AContext.WatchRes, TestWatchDisplayFormat, ''), AContext, AnIgnoreRsn);
end; end;
end; end;
@ -1770,7 +1773,7 @@ begin
else else
s := IntToStr(Expect.expIntValue); s := IntToStr(Expect.expIntValue);
Result := TestEquals('Data', s, FWatchResultPrinter.PrintWatchValue(AContext.WatchRes, DefaultWatchDisplayFormat, ''), AContext, AnIgnoreRsn); Result := TestEquals('Data', s, FWatchResultPrinter.PrintWatchValue(AContext.WatchRes, TestWatchDisplayFormat, ''), AContext, AnIgnoreRsn);
end end
else begin else begin
if IsCardinal then begin if IsCardinal then begin
@ -1803,7 +1806,7 @@ begin
Expect := AContext.Expectation; Expect := AContext.Expectation;
WriteStr(s, Expect.ExpBoolValue); WriteStr(s, Expect.ExpBoolValue);
v := FWatchResultPrinter.PrintWatchValue(AContext.WatchRes, DefaultWatchDisplayFormat, ''); v := FWatchResultPrinter.PrintWatchValue(AContext.WatchRes, TestWatchDisplayFormat, '');
if AContext.Expectation.ExpResultKind = rkSizedBool then begin if AContext.Expectation.ExpResultKind = rkSizedBool then begin
i := pos('(', v); i := pos('(', v);
if i > 1 then if i > 1 then
@ -1824,7 +1827,7 @@ begin
Expect := AContext.Expectation; Expect := AContext.Expectation;
if AContext.WatchRes.ValueKind = rdkPrePrinted then begin if AContext.WatchRes.ValueKind = rdkPrePrinted then begin
Result := TestEquals('Data', FloatToStr(Expect.ExpFloatValue), FWatchResultPrinter.PrintWatchValue(AContext.WatchRes, DefaultWatchDisplayFormat, ''), EqIgnoreCase, AContext, AnIgnoreRsn); Result := TestEquals('Data', FloatToStr(Expect.ExpFloatValue), FWatchResultPrinter.PrintWatchValue(AContext.WatchRes, TestWatchDisplayFormat, ''), EqIgnoreCase, AContext, AnIgnoreRsn);
end end
else begin else begin
Result := TestTrue('ValKind', AContext.WatchRes.ValueKind = rdkFloatVal, AContext, AnIgnoreRsn); Result := TestTrue('ValKind', AContext.WatchRes.ValueKind = rdkFloatVal, AContext, AnIgnoreRsn);
@ -1842,7 +1845,7 @@ begin
Result := True; Result := True;
Expect := AContext.Expectation; Expect := AContext.Expectation;
Result := TestEquals('Data', Expect.ExpTextData, FWatchResultPrinter.PrintWatchValue(AContext.WatchRes, DefaultWatchDisplayFormat, ''), not(Compiler.SymbolType in stDwarf2), AContext, AnIgnoreRsn); Result := TestEquals('Data', Expect.ExpTextData, FWatchResultPrinter.PrintWatchValue(AContext.WatchRes, TestWatchDisplayFormat, ''), not(Compiler.SymbolType in stDwarf2), AContext, AnIgnoreRsn);
end; end;
end; end;
@ -1858,7 +1861,7 @@ begin
Result := True; Result := True;
Expect := AContext.Expectation; Expect := AContext.Expectation;
v := FWatchResultPrinter.PrintWatchValue(AContext.WatchRes, DefaultWatchDisplayFormat, ''); v := FWatchResultPrinter.PrintWatchValue(AContext.WatchRes, TestWatchDisplayFormat, '');
if (v='') or (v[1] <> '[') or (v[length(v)] <> ']') then begin if (v='') or (v[1] <> '[') or (v[length(v)] <> ']') then begin
Result := TestTrue('elements are in [...]', False, AContext, AnIgnoreRsn); Result := TestTrue('elements are in [...]', False, AContext, AnIgnoreRsn);
@ -1896,7 +1899,7 @@ begin
else else
e := QuoteText(Expect.ExpTextData); e := QuoteText(Expect.ExpTextData);
v := FWatchResultPrinter.PrintWatchValue(AContext.WatchRes, DefaultWatchDisplayFormat, ''); v := FWatchResultPrinter.PrintWatchValue(AContext.WatchRes, TestWatchDisplayFormat, '');
if ehCharFromIndex in ehf then begin if ehCharFromIndex in ehf then begin
if v <> e then begin if v <> e then begin
//AnIgnoreRsn := AnIgnoreRsn + 'char from index not implemented'; //AnIgnoreRsn := AnIgnoreRsn + 'char from index not implemented';
@ -1925,7 +1928,7 @@ begin
Expect := AContext.Expectation; Expect := AContext.Expectation;
if AContext.WatchRes.ValueKind = rdkPrePrinted then begin if AContext.WatchRes.ValueKind = rdkPrePrinted then begin
v := FWatchResultPrinter.PrintWatchValue(AContext.WatchRes, DefaultWatchDisplayFormat, ''); v := FWatchResultPrinter.PrintWatchValue(AContext.WatchRes, TestWatchDisplayFormat, '');
ehf := Expect.ExpErrorHandlingFlags[Compiler.SymbolType]; ehf := Expect.ExpErrorHandlingFlags[Compiler.SymbolType];
// in dwarf 2 ansistring are pchar // in dwarf 2 ansistring are pchar
@ -2012,7 +2015,7 @@ begin
else else
e := QuoteText(Expect.ExpTextData); e := QuoteText(Expect.ExpTextData);
Result := TestEquals('Data', e, FWatchResultPrinter.PrintWatchValue(AContext.WatchRes, DefaultWatchDisplayFormat, ''), AContext, AnIgnoreRsn); Result := TestEquals('Data', e, FWatchResultPrinter.PrintWatchValue(AContext.WatchRes, TestWatchDisplayFormat, ''), AContext, AnIgnoreRsn);
end end
else begin else begin
Result := TestTrue('ValueKind', AContext.WatchRes.ValueKind = rdkString, AContext, AnIgnoreRsn); Result := TestTrue('ValueKind', AContext.WatchRes.ValueKind = rdkString, AContext, AnIgnoreRsn);
@ -2036,7 +2039,7 @@ begin
ehf := Expect.ExpErrorHandlingFlags[Compiler.SymbolType]; ehf := Expect.ExpErrorHandlingFlags[Compiler.SymbolType];
if AContext.WatchRes.ValueKind = rdkPrePrinted then begin if AContext.WatchRes.ValueKind = rdkPrePrinted then begin
g := FWatchResultPrinter.PrintWatchValue(AContext.WatchRes, DefaultWatchDisplayFormat, ''); g := FWatchResultPrinter.PrintWatchValue(AContext.WatchRes, TestWatchDisplayFormat, '');
e := '(\$[0-9a-fA-F]*\^?|nil)'; e := '(\$[0-9a-fA-F]*\^?|nil)';
tn := GetExpTypeNameAsRegEx(Expect); tn := GetExpTypeNameAsRegEx(Expect);
@ -2187,7 +2190,7 @@ begin
end; end;
end; end;
v := FWatchResultPrinter.PrintWatchValue(AContext.WatchRes, DefaultWatchDisplayFormat, ''); v := FWatchResultPrinter.PrintWatchValue(AContext.WatchRes, TestWatchDisplayFormat, '');
debugln([' expect ',Expect.ExpFullArrayLen,' got "',v,'"' ]); debugln([' expect ',Expect.ExpFullArrayLen,' got "',v,'"' ]);
if CompareText(v, 'nil') = 0 then begin if CompareText(v, 'nil') = 0 then begin
@ -2248,7 +2251,7 @@ begin
Expect := AContext.Expectation; Expect := AContext.Expectation;
ehf := Expect.ExpErrorHandlingFlags[Compiler.SymbolType]; ehf := Expect.ExpErrorHandlingFlags[Compiler.SymbolType];
v := Trim(FWatchResultPrinter.PrintWatchValue(AContext.WatchRes, DefaultWatchDisplayFormat, '')); v := Trim(FWatchResultPrinter.PrintWatchValue(AContext.WatchRes, TestWatchDisplayFormat, ''));
delete(v, 1, pos('(', v)); delete(v, 1, pos('(', v));
delete(v, length(v), 1); delete(v, length(v), 1);
@ -2298,7 +2301,7 @@ begin
if j >= 0 then begin if j >= 0 then begin
SubContext.WatchRes := TWatchResultDataPrePrinted.Create( SubContext.WatchRes := TWatchResultDataPrePrinted.Create(
FWatchResultPrinter.PrintWatchValue(AContext.WatchRes.Fields[j].Field, DefaultWatchDisplayFormat, '') FWatchResultPrinter.PrintWatchValue(AContext.WatchRes.Fields[j].Field, TestWatchDisplayFormat, '')
); );
FTest.TestBaseName := n + ' Idx=' + IntToStr(i)+' '; FTest.TestBaseName := n + ' Idx=' + IntToStr(i)+' ';
SubContext.Expectation := sr; SubContext.Expectation := sr;
@ -2320,7 +2323,7 @@ begin
with AContext.WatchExp do begin with AContext.WatchExp do begin
Result := True; Result := True;
v := Trim(FWatchResultPrinter.PrintWatchValue(AContext.WatchRes, DefaultWatchDisplayFormat, '')); v := Trim(FWatchResultPrinter.PrintWatchValue(AContext.WatchRes, TestWatchDisplayFormat, ''));
TestTrue('TODO / some text', v <> '', AContext, AnIgnoreRsn); TestTrue('TODO / some text', v <> '', AContext, AnIgnoreRsn);
TestTrue('rdkStruct', AContext.WatchRes.ValueKind = rdkStruct, AContext, AnIgnoreRsn); TestTrue('rdkStruct', AContext.WatchRes.ValueKind = rdkStruct, AContext, AnIgnoreRsn);
@ -2338,7 +2341,7 @@ begin
with AContext.WatchExp do begin with AContext.WatchExp do begin
Result := True; Result := True;
v := Trim(FWatchResultPrinter.PrintWatchValue(AContext.WatchRes, DefaultWatchDisplayFormat, '')); v := Trim(FWatchResultPrinter.PrintWatchValue(AContext.WatchRes, TestWatchDisplayFormat, ''));
TestTrue('TODO / some text', v <> '', AContext, AnIgnoreRsn); TestTrue('TODO / some text', v <> '', AContext, AnIgnoreRsn);
TestTrue('rdkStruct', AContext.WatchRes.ValueKind = rdkStruct, AContext, AnIgnoreRsn); TestTrue('rdkStruct', AContext.WatchRes.ValueKind = rdkStruct, AContext, AnIgnoreRsn);
@ -2356,7 +2359,7 @@ begin
with AContext.WatchExp do begin with AContext.WatchExp do begin
Result := True; Result := True;
v := Trim(FWatchResultPrinter.PrintWatchValue(AContext.WatchRes, DefaultWatchDisplayFormat, '')); v := Trim(FWatchResultPrinter.PrintWatchValue(AContext.WatchRes, TestWatchDisplayFormat, ''));
TestTrue('TODO / some text', v <> '', AContext, AnIgnoreRsn); TestTrue('TODO / some text', v <> '', AContext, AnIgnoreRsn);
TestTrue('rdkStruct', AContext.WatchRes.ValueKind = rdkStruct, AContext, AnIgnoreRsn); TestTrue('rdkStruct', AContext.WatchRes.ValueKind = rdkStruct, AContext, AnIgnoreRsn);
@ -2377,7 +2380,7 @@ begin
with AContext.WatchExp do begin with AContext.WatchExp do begin
Result := True; Result := True;
v := Trim(FWatchResultPrinter.PrintWatchValue(AContext.WatchRes, DefaultWatchDisplayFormat, '')); v := Trim(FWatchResultPrinter.PrintWatchValue(AContext.WatchRes, TestWatchDisplayFormat, ''));
TestTrue('TODO / some text', v <> '', AContext, AnIgnoreRsn); TestTrue('TODO / some text', v <> '', AContext, AnIgnoreRsn);
TestTrue('rdkStruct', AContext.WatchRes.ValueKind = rdkStruct, AContext, AnIgnoreRsn); TestTrue('rdkStruct', AContext.WatchRes.ValueKind = rdkStruct, AContext, AnIgnoreRsn);
@ -2573,5 +2576,10 @@ begin
CheckResults; CheckResults;
end; end;
initialization
TestWatchDisplayFormat := DefaultWatchDisplayFormat;
TestWatchDisplayFormat.ArrayLen.UseInherited := False;
TestWatchDisplayFormat.ArrayLen.ShowLenPrefix := False;
end. end.

View File

@ -1352,9 +1352,9 @@ begin
Result.RawAsStringPtr^ := 'Error: Unknown'; Result.RawAsStringPtr^ := 'Error: Unknown';
rdkPrePrinted: begin rdkPrePrinted: begin
if rpfClearMultiLine in FFormatFlags then if rpfClearMultiLine in FFormatFlags then
Result.RawAsStringPtr^ := AResValue.AsString Result.RawAsStringPtr^ := ClearMultiline(AResValue.AsString)
else else
Result.RawAsStringPtr^ := ClearMultiline(AResValue.AsString); Result.RawAsStringPtr^ := AResValue.AsString;
end; end;
rdkSignedNumVal, rdkSignedNumVal,
rdkUnsignedNumVal: begin rdkUnsignedNumVal: begin