we wrote this test
testHasExactlySamePropertiesThan
"self debug: #testHasExactlySamePropertiesThan"
| cp |
"I should have the same entity than a copy of myself"
self assert: (self nodeClass hasExactlySamePropertiesThan: self nodeClass).
self assert: (self nodeClass hasExactlySamePropertiesThan: self nodeClass veryDeepCopy).
the previous assertion does not work because the incoming references are indeed not pointing to the copy so this is correct that it does not work.
cp := self model entityNamed: LANOutputServer mooseName.
self deny: (self nodeClass hasExactlySamePropertiesThan: cp).
cp := self nodeClass veryDeepCopy.
cp instVarNamed: 'state' put: (cp instVarNamed: 'state') veryDeepCopy.
cp propertyNamed: #numberOfLinesOfCode put: 12000.
"This property is described as a fame property on the entity kind but not existing on the copy
so two entities should have different properties"
self deny: (self nodeClass hasExactlySamePropertiesThan: cp).
cp := self nodeClass veryDeepCopy.
cp instVarNamed: 'state' put: (cp instVarNamed: 'state') veryDeepCopy.
cp propertyNamed: #NOS ifAbsentPut: 12000.
"This property is described but it does not exist on the entity kind
so two entities should have different properties"
self deny: (self nodeClass hasExactlySamePropertiesThan: cp).
Now is there a way to only access the values that are stored in the properties?
Because right now we are using
allDeclaredProperties
and they include all the instance variable as well.
--
Andre Hora