RegressionTests__BinaryIOTests.st
changeset 614 61a039961050
parent 555 9ffbf260e086
child 649 415a9f079659
--- a/RegressionTests__BinaryIOTests.st	Fri Aug 05 18:59:31 2011 +0200
+++ b/RegressionTests__BinaryIOTests.st	Sun Aug 07 15:31:26 2011 +0200
@@ -349,7 +349,7 @@
 
 testSaveReadBOS
 
-    |obj fn bos child |
+    |obj fn bos child privateClass didConvert|
 
     Class withoutUpdatingChangesDo:[
         HierarchicalItem subclass:#XHierarchicalItem
@@ -357,22 +357,30 @@
             classVariableNames:''
             poolDictionaries:''
             category:'Views-Support'.
+
+        privateClass := Smalltalk at:#XHierarchicalItem.
     ].
 
-    obj := XHierarchicalItem  new.
-    child := XHierarchicalItem new.
+    obj := privateClass  new.
+    child := privateClass new.
     obj add: child.
-    child instVarNamed:#width put:XHierarchicalItem.
+    child instVarNamed:#width put:privateClass.
 
     "/ fn := '/tmp/HI' asFilename.
     fn := Filename newTemporary.
     bos :=  BinaryObjectStorage onNew: (fn writeStream).
     bos nextPut: obj.
-obj inspect.
+
+    Stdout showCR:'object saved:'.
+    "/ obj inspect.
+    ObjectMemory dumpObject:obj.
     bos close.
 
+    didConvert := false.
+
+    "/ now, change the class (store object is old)
     Class withoutUpdatingChangesDo:[
-        XHierarchicalItem addInstVarName:'foo'
+        privateClass addInstVarName:'foo'
     ].
 
     bos := BinaryObjectStorage onOld: fn readStream.
@@ -381,7 +389,8 @@
 
         newClass := ex parameter key.
         oldObject := ex parameter value.
-        Transcript showCR: 'converting...'.
+        Stdout showCR: 'converting...'.
+        didConvert := true.
         ex proceedWith: (newClass cloneFrom: oldObject).
     ] do:[
         BinaryIOManager invalidClassSignal handle:[:ex2|
@@ -395,12 +404,17 @@
             ex2 proceedWith: proceedClass.
         ] do:[
             obj := bos next.
-            obj inspect.
+            "/ obj inspect.
+            Stdout showCR:'object restored (new class):'.
+            ObjectMemory dumpObject:obj.
         ].
     ].
 
+    self assert:(didConvert).
+    self assert:(obj class instSize == (HierarchicalItem instSize + 1)).
+
     "Created: / 26-09-2007 / 18:21:11 / cg"
-    "Modified: / 27-09-2007 / 09:47:32 / cg"
+    "Modified: / 07-08-2011 / 15:29:35 / cg"
 !
 
 testStrings1