add diagnostic output to the command implementation record

...allows better diagnostic in tests, when handling a command
through the new mock handling pattern within Test-Nexus
This commit is contained in:
Fischlurch 2016-02-05 23:55:07 +01:00
parent 3faf586c56
commit deb7a6758c
2 changed files with 13 additions and 2 deletions

View file

@ -47,6 +47,7 @@
#include "proc/control/command-mutation.hpp" #include "proc/control/command-mutation.hpp"
#include "lib/typed-allocation-manager.hpp" #include "lib/typed-allocation-manager.hpp"
#include "lib/bool-checkable.hpp" #include "lib/bool-checkable.hpp"
#include "lib/format-string.hpp"
#include <boost/noncopyable.hpp> #include <boost/noncopyable.hpp>
#include <boost/operators.hpp> #include <boost/operators.hpp>
@ -58,6 +59,7 @@
namespace proc { namespace proc {
namespace control { namespace control {
using util::_Fmt;
using std::function; using std::function;
using std::shared_ptr; using std::shared_ptr;
@ -219,6 +221,15 @@ namespace control {
return isValid() && pClo_->isCaptured(); return isValid() && pClo_->isCaptured();
} }
operator string() const
{
return _Fmt("Cmd|valid:%s, exec:%s, undo:%s |%s")
% isValid()
% canExec()
% canUndo()
% (pClo_? string(*pClo_) : util::FAILURE_INDICATOR);
}
friend bool friend bool

View file

@ -449,7 +449,7 @@ namespace test{
void void
performExec (CommandImpl& command) const override performExec (CommandImpl& command) const override
{ {
log_.call ("TestNexus", "exec"); log_.call ("MockHandlingPattern", "exec", command);
command.invokeCapture(); command.invokeCapture();
command.invokeOperation(); command.invokeOperation();
} }
@ -457,7 +457,7 @@ namespace test{
void void
performUndo (CommandImpl& command) const override performUndo (CommandImpl& command) const override
{ {
log_.call ("TestNexus", "undo"); log_.call ("MockHandlingPattern", "undo", command);
command.invokeUndo(); command.invokeUndo();
} }