Francois Gouget : testbot: Fix Collection::Validate() errors for new Items.

Alexandre Julliard julliard at winehq.org
Thu Mar 14 11:41:37 CDT 2019


Module: tools
Branch: master
Commit: 1785caeaa68d0a2e69b780c6810255a649309ab6
URL:    https://source.winehq.org/git/tools.git/?a=commit;h=1785caeaa68d0a2e69b780c6810255a649309ab6

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Thu Mar 14 12:02:37 2019 +0100

testbot: Fix Collection::Validate() errors for new Items.

New Items don't have a full key yet so it cannot be put in the error
message. Instead indicate the error happened on a new object and give
its partial key.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 testbot/lib/ObjectModel/Collection.pm | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/testbot/lib/ObjectModel/Collection.pm b/testbot/lib/ObjectModel/Collection.pm
index c110c98..1fe1481 100644
--- a/testbot/lib/ObjectModel/Collection.pm
+++ b/testbot/lib/ObjectModel/Collection.pm
@@ -495,11 +495,16 @@ sub Validate($)
   {
     if ($Item->GetIsNew() || $Item->GetIsModified())
     {
-      (my $ErrProperty, my $ErrMessage) = $Item->Validate();
-      if (defined($ErrMessage))
+      my ($ErrProperty, $ErrMessage) = $Item->Validate();
+      if (defined $ErrMessage)
       {
-        return ($Item->GetKey(), $ErrProperty, "$ErrMessage for " .
-                $self->GetItemName() . " " . $Item->GetFullKey());
+        my $Key = $Item->GetKey();
+        my $FullKey = $Item->GetFullKey();
+        if (defined $FullKey)
+        {
+          return ($Key, $ErrProperty, "$ErrMessage for ". $self->GetItemName() ." $FullKey");
+        }
+        return ($Key, $ErrProperty, "$ErrMessage for new ". $self->GetItemName() ." $Key");
       }
       if ($Item->GetIsNew())
       {




More information about the wine-cvs mailing list