Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
valuesportinglog [2022/01/31 19:26]
christian [FileIn 6 - Tests]
valuesportinglog [2022/02/04 07:16]
christian [FileIn 7 - Tests]
Line 182: Line 182:
 Loads without errors or warnings!. Loads without errors or warnings!.
  
-First milestome achieved: fileIn without errors.+<HTML> 
 +First milestone<span style="background-color:yellow;font-size:150%;border:2px solid lightgray;">Clean fileIn without errors or warnings!</span><br><br> 
 +</HTML>
  
 Next step: fileIn the tests. Next step: fileIn the tests.
Line 188: Line 190:
 ===== FileIn 6 - Tests ===== ===== FileIn 6 - Tests =====
  
-Added Squeak class methods #fileOutValuesTesting with the transformations #ValuesTestingTransform.+Added Squeak class method ''#fileOutValuesTesting'' analog to ''#fileOutValues'': 
 + 
 +<code Smalltalk>fileOutValuesTesting 
 + self 
 + write: ('.' asFilename construct: 'ValuesTesting.Squeak.st'
 + pundles: (Array with: (Store.Registry packageNamed: #'Values Testing')) 
 + package: #'Values-Testing' 
 + prerequisites: nil 
 + packageChanges: (Valuemap with: 'Values Testing' -> self ValuesTestingTransform
 +</code> 
 + 
 +with the standard transformation for Value classes: 
 + 
 +<code Smalltalk> 
 +ValuesTestingTransform 
 + ^PackageChange hierarchyChanges: (Array with: (ClassChange 
 + classReference: #{Smalltalk.Value} 
 + classChanges: (Array with: (Rewrite method: #localSpecification rule: #replaceLiteralBindingWithPath)))) 
 +</code>
  
 FileOut from VW with: FileOut from VW with:
 +
 <code Smalltalk>Squeak fileOutValuesTesting</code> <code Smalltalk>Squeak fileOutValuesTesting</code>
-then fileIn into a fresh Squeak image.+ 
 +then fileIn into a Squeak image  with Values loaded.
  
 Loads without errors. Loads without errors.
Line 208: Line 230:
 ValuemapTests>>testRemoving (NotFoundError is Undeclared)  ValuemapTests>>testRemoving (NotFoundError is Undeclared) 
 </code> </code>
 +
 +The VW error classes are not known in Squeak. We define a rewrite of the three test methods:
 +
 +<code Smalltalk>
 +ValuesTestingTransform
 + ^PackageChange
 + hierarchyChanges: (Array with: (ClassChange
 + classReference: #{Smalltalk.Value}
 + classChanges: (Array with: (Rewrite method: #localSpecification rule: #replaceLiteralBindingWithPath))))
 + localChanges: (Array with: (ClassChange
 + classReference: #{Smalltalk.ValuemapTests}
 + instanceChanges: ((OrderedCollection new)
 + add: (Rewrite method: #testIndexedAccess rule: #replaceSqueakErrorClasses);
 + add: (Rewrite method: #testKeyedAccess rule: #replaceSqueakErrorClasses);
 + add: (Rewrite method: #testRemoving rule: #replaceSqueakErrorClasses);
 + yourself)))
 +</code>
 +
 +The rule ''#replaceSqueakErrorClasses'' in class ''ParseTreeRewriter'' (analog to ''#replaceGemstoneErrorClasses'') replaces the Error classes by string replacement:
 +
 +<code Smalltalk>
 +replaceSqueakErrorClasses
 + ^(self new)
 + replace: SubscriptOutOfBoundsError name asString with: #Error asString;
 + replace: NonIntegerIndexError name asString with: #Error asString;
 + replace: NotFoundError name asString with: #NotFound asString;
 + yourself
 +</code>
 +
 +Published as **[Squeak Fileout PDFtalk] (3.0.0.7,chaider)** with the updated transformation.
 +===== FileIn 7 - Tests =====
 +
 +FileOut [Values] and [Values Testing], then fileIn into a fresh Squeak image.
 +
 +Loads without errors or warnings!
 +
 +<HTML>
 +2. milestone: <span style="background-color:yellow;font-size:150%;border:2px solid lightgray;">Clean fileIn of the tests without errors or warnings!</span><br><br>
 +</HTML>
 +
 +Test results:
 +25 run in 0:00:00:00, 0 passes, 0 expected failures, 1 failures, 24 errors, 0 unexpected passes
 +
 +{{:values:2022-02-01_values.squeak.zip |This Squeak fileOut (2022-02-01)}} contains the current ''Values.Squeak.st'' and ''ValuesTesting.Squeak.st''.
 +
 +The next step must be done in Squeak: fix the implementation to make the tests pass and modify the transformation so that the next fileOut contains the right code.
  • valuesportinglog.txt
  • Last modified: 2022/02/27 13:34
  • by christian