View Issue Details

IDProjectCategoryView StatusLast Update
0034131FPCFCLpublic2018-08-14 15:50
ReporterFr0sTAssigned ToMichael Van Canneyt 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformanyOSanyOS Versionany
Product Version3.1.1Product Build 
Target Version3.2.0Fixed in Version3.1.1 
Summary0034131: FPCUnit - TAssert.CheckIs eats message parameter
DescriptionCurrently TAssert.CheckIs does not use msg parameter

class procedure TAssert.CheckIs(obj: TObject; pClass: TClass; msg: string);
begin
  Assert(pClass <> nil);
  if obj = nil then
    Fail(ComparisonMsg(pClass.ClassName, 'nil'))
  else if not obj.ClassType.InheritsFrom(pClass) then
    Fail(ComparisonMsg(pClass.ClassName, obj.ClassName));
end;

the patch attached adds msg to ComparisonMsg call
Tagsfpcunit
Fixed in Revision39613
FPCOldBugId
FPCTarget
Attached Files
  • CheckIs.diff (910 bytes)
     packages/fcl-fpcunit/src/DUnitCompatibleInterface.inc | 4 ++--
     1 file changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/packages/fcl-fpcunit/src/DUnitCompatibleInterface.inc b/packages/fcl-fpcunit/src/DUnitCompatibleInterface.inc
    index f78d1826d6..7733046e26 100644
    --- a/packages/fcl-fpcunit/src/DUnitCompatibleInterface.inc
    +++ b/packages/fcl-fpcunit/src/DUnitCompatibleInterface.inc
    @@ -186,9 +186,9 @@ class procedure TAssert.CheckIs(obj: TObject; pClass: TClass; msg: string);
     begin
       Assert(pClass <> nil);
       if obj = nil then
    -    Fail(ComparisonMsg(pClass.ClassName, 'nil'))
    +    Fail(ComparisonMsg(msg, pClass.ClassName, 'nil'))
       else if not obj.ClassType.InheritsFrom(pClass) then
    -    Fail(ComparisonMsg(pClass.ClassName, obj.ClassName));
    +    Fail(ComparisonMsg(msg, pClass.ClassName, obj.ClassName));
     end;
     
     class procedure TAssert.CheckSame(expected, actual: TObject; msg: string);
    
    CheckIs.diff (910 bytes)

Activities

Fr0sT

2018-08-14 15:43

reporter  

CheckIs.diff (910 bytes)
 packages/fcl-fpcunit/src/DUnitCompatibleInterface.inc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/packages/fcl-fpcunit/src/DUnitCompatibleInterface.inc b/packages/fcl-fpcunit/src/DUnitCompatibleInterface.inc
index f78d1826d6..7733046e26 100644
--- a/packages/fcl-fpcunit/src/DUnitCompatibleInterface.inc
+++ b/packages/fcl-fpcunit/src/DUnitCompatibleInterface.inc
@@ -186,9 +186,9 @@ class procedure TAssert.CheckIs(obj: TObject; pClass: TClass; msg: string);
 begin
   Assert(pClass <> nil);
   if obj = nil then
-    Fail(ComparisonMsg(pClass.ClassName, 'nil'))
+    Fail(ComparisonMsg(msg, pClass.ClassName, 'nil'))
   else if not obj.ClassType.InheritsFrom(pClass) then
-    Fail(ComparisonMsg(pClass.ClassName, obj.ClassName));
+    Fail(ComparisonMsg(msg, pClass.ClassName, obj.ClassName));
 end;
 
 class procedure TAssert.CheckSame(expected, actual: TObject; msg: string);
CheckIs.diff (910 bytes)

Michael Van Canneyt

2018-08-14 15:50

administrator   ~0110035

Applied, thanks for the patch!

Issue History

Date Modified Username Field Change
2018-08-14 15:43 Fr0sT New Issue
2018-08-14 15:43 Fr0sT File Added: CheckIs.diff
2018-08-14 15:43 Fr0sT Tag Attached: fpcunit
2018-08-14 15:48 Michael Van Canneyt Assigned To => Michael Van Canneyt
2018-08-14 15:48 Michael Van Canneyt Status new => assigned
2018-08-14 15:50 Michael Van Canneyt Fixed in Revision => 39613
2018-08-14 15:50 Michael Van Canneyt Note Added: 0110035
2018-08-14 15:50 Michael Van Canneyt Status assigned => resolved
2018-08-14 15:50 Michael Van Canneyt Fixed in Version => 3.1.1
2018-08-14 15:50 Michael Van Canneyt Resolution open => fixed
2018-08-14 15:50 Michael Van Canneyt Target Version => 3.2.0