Commits

Jan Borsodi  committed a2114f1 Merge

Merged with hob.

  • Participants
  • Parent commits 330dacb, fbf9d21

Comments (0)

Files changed (1)

File templates/js/test_framework.js

         item));
   }
 
+  this._get_recursiv_message = function _get_recursiv_message(definitions, definition)
+  {
+    for (var def = null, i = 0, ret = null; def = definitions[i]; i++)
+    {
+      if (def.name == definition.name)
+      {
+        return def.message;
+      }
+      if (def.message && typeof def.message == 'object')
+      {
+        if (ret = _get_recursiv_message(def.message, definition))
+        {
+          return ret;
+        }
+      }
+    }
+    return null;
+  }
+
   this._pretty_print_payload = function(payload, definitions, indent)
   {
     var 
     definition = null,
     j = 0;
 
-    //# TODO message: self
+    if (!this._definitions)
+    {
+      this._definitions = definitions;
+    }
+
     if (definitions)
     {
       for (; i < payload.length; i++)
           item = [];
         }
         definition = definitions[i];
+        if (definition && (definition.message == "self"))
+        {
+          definition.message = this._get_recursiv_message(this._definitions, definition);
+        }
         if (definition["q"] == "repeated")
         {
           ret.push(this._get_indent(indent) + definition['name'] + ':');
             item))
         }
       }
-      return ret.join("\n")
     }
-    return "";
+    this._definitions = null;
+    return ret.join("\n")
   }
 
   // handle a command response
     }
   }
 
-}
+}