change lib::Record string representation to handle empty parts better

...no need to enclose empty sections when there are no
attributes or no children. Makes test code way more readable.



TestEventLog_test PASS as far as implemented
This commit is contained in:
Fischlurch 2015-12-05 03:57:11 +01:00
parent 00abf9f1f9
commit 5874b1b4dc
3 changed files with 8 additions and 9 deletions

View file

@ -731,11 +731,10 @@ namespace diff{
using lib::transformIterator;
return "Rec("
+ (TYPE_NIL==type_? "" : type_+"| ")
+ join (transformIterator (this->attribs(), renderAttribute))
+ " |{"
+ join (this->scope())
+ "})"
+ (TYPE_NIL==type_? "" : type_)
+ (isnil(this->attribs())? "" : "| "+join (transformIterator (this->attribs(), renderAttribute))+" ")
+ (isnil(this->scope())? "" : "|{"+join (this->scope())+"}")
+ ")"
;
#endif
}

View file

@ -256,7 +256,7 @@ END
TEST "Generic Record data node" GenNodeBasic_test <<END
out: GenNode.+_CHILD_Record.+Rec.spam..ham = DataCap.+eggs
out-lit: --spam--
out: GenNode.+"baked beans".+Rec.hasSpam = DataCap.«bool».+«char».+«std::string».*«double».+GenNode.+"spam".+«lib::diff::Record<lib::diff::GenNode>».+«std::string».eggs.+«std::string».spam.+«std::string».spam
out: GenNode.+"baked beans".+Rec...hasSpam = DataCap.«bool».+«char».+«std::string».*«double».+GenNode.+"spam".+«lib::diff::Record<lib::diff::GenNode>».+«std::string».eggs.+«std::string».spam.+«std::string».spam
out: GenNode.+"hasSpam".+«bool».1
out: GenNode.+_CHILD_char.+«char».\*
out: GenNode.+_CHILD_string.+«std::string».★

View file

@ -87,9 +87,9 @@ namespace test{
log.verify("α").before("β");
VERIFY_ERROR (ASSERTION, log.verify("β").before("α"));
CHECK (join(log) == "Rec(EventLogHeader| ID = TestEventLog_test."+idi::instanceTypeID(this)+" |), "
+ "Rec(event| |{α}), "
+ "Rec(event| |{β})");
CHECK (join(log) == "Rec(EventLogHeader| ID = "+idi::instanceTypeID(this)+" ), "
+ "Rec(event|{α}), "
+ "Rec(event|{β})");
}