@@ -43,8 +43,8 @@ destructor TCustomResultWriter.Destroy;
4343
4444procedure TCustomResultWriter.AddFailure (ATest: TTest; AFailure: TTestFailure);
4545var
46- JData : TJSONData;
47- LMessage, LGot, LExpected : string;
46+ JData : TJSONData;
47+ LMessage, LGot, LExpect : string;
4848begin
4949
5050 FTestPassed := false;
@@ -54,16 +54,22 @@ procedure TCustomResultWriter.AddFailure(ATest: TTest; AFailure: TTestFailure);
5454 try
5555 JData := GetJSON(AFailure.ExceptionMessage);
5656 LMessage := JData.FindPath(' message' ).AsString;
57- if GetEnumName(
58- TypeInfo(TJSONtype), ord(JData.FindPath(' expected' ).JSONType)
59- ) = ' jtArray' then
60- LExpected := JData.FindPath(' expected' ).FormatJSON
61- else LExpected := JData.FindPath(' expected' ).AsString;
62- if GetEnumName(
57+ case
58+ GetEnumName(
59+ TypeInfo(TJSONtype), ord(JData.FindPath(' expect' ).JSONType)
60+ ) of
61+ ' jtArray' , ' jtObject' :
62+ LExpect := JData.FindPath(' expect' ).FormatJSON;
63+ otherwise LExpect := JData.FindPath(' expect' ).AsString;
64+ end ;
65+ case
66+ GetEnumName(
6367 TypeInfo(TJSONtype), ord(JData.FindPath(' actual' ).JSONType)
64- ) = ' jtArray' then
65- LGot := JData.FindPath(' actual' ).FormatJSON
66- else LGot := JData.FindPath(' actual' ).AsString;
68+ ) of
69+ ' jtArray' , ' jtObject' :
70+ LGot := JData.FindPath(' actual' ).FormatJSON
71+ otherwise LGot := JData.FindPath(' actual' ).AsString;
72+ end ;
6773 finally
6874 JData.Free;
6975 end
@@ -93,12 +99,12 @@ procedure TCustomResultWriter.AddFailure(ATest: TTest; AFailure: TTestFailure);
9399 else
94100 writeln(' got: ' , LGot);
95101
96- if pos(#10 , LExpected ) > 0 then
102+ if pos(#10 , LExpect ) > 0 then
97103 begin
98- writeln(' expected : |' );
99- writeln(' ' + ReplaceStr(LExpected , #10 , #10 + ' ' ));
104+ writeln(' expect : |' );
105+ writeln(' ' + ReplaceStr(LExpect , #10 , #10 + ' ' ));
100106 end
101- else writeln(' expect: ' , LExpected );
107+ else writeln(' expect: ' , LExpect );
102108
103109 writeln(' ...' );
104110end ;
0 commit comments