Levente Uzonyi uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-ul.207.mcz ==================== Summary ==================== Name: System-ul.207 Author: ul Time: 28 December 2009, 5:30:37 am UUID: b566f1d1-ddad-2147-b273-adb33e83f55d Ancestors: System-ar.206 - added TextDiffBuilderTest =============== Diff against System-ar.206 =============== Item was added: + ----- Method: TextDiffBuilderTest>>testEmptyLcs1 (in category 'tests') ----- + testEmptyLcs1 + + | patch | + patch := self patchSequenceFor: #(a b c) and: #(). + self assert: patch size = 3. + self assert: (patch allSatisfy: [ :each | each key = #remove ])! Item was changed: SystemOrganization addCategory: #'System-Applications'! SystemOrganization addCategory: #'System-Change Notification'! SystemOrganization addCategory: #'System-Changes'! SystemOrganization addCategory: #'System-Digital Signatures'! SystemOrganization addCategory: #'System-Digital Signatures-Tests'! SystemOrganization addCategory: #'System-Download'! SystemOrganization addCategory: #'System-FilePackage'! + SystemOrganization addCategory: #'System-FilePackage-Tests'! SystemOrganization addCategory: #'System-FileRegistry'! SystemOrganization addCategory: #'System-Finalization'! SystemOrganization addCategory: #'System-Localization'! SystemOrganization addCategory: #'System-Object Events'! SystemOrganization addCategory: #'System-Object Events-Tests'! SystemOrganization addCategory: #'System-Object Storage'! SystemOrganization addCategory: #'System-Pools'! SystemOrganization addCategory: #'System-Preferences'! SystemOrganization addCategory: #'System-Serial Port'! SystemOrganization addCategory: #'System-Support'! SystemOrganization addCategory: #'System-Support-Tests'! SystemOrganization addCategory: #'System-Tools'! Item was added: + ----- Method: TextDiffBuilderTest>>testSameSequence (in category 'tests') ----- + testSameSequence + + | patch | + patch := self patchSequenceFor: #(a b c) and: #(a b c). + self assert: patch size = 3. + self assert: (patch allSatisfy: [ :each | each key = #match ])! Item was added: + ----- Method: TextDiffBuilderTest>>convertToString: (in category 'private') ----- + convertToString: array + + ^String streamContents: [ :stream | + array do: [ :each | + stream nextPutAll: each asString; cr ] ]! Item was added: + TestCase subclass: #TextDiffBuilderTest + instanceVariableNames: '' + classVariableNames: '' + poolDictionaries: '' + category: 'System-FilePackage-Tests'! Item was added: + ----- Method: TextDiffBuilderTest>>testIfPatchIsMinimal (in category 'tests') ----- + testIfPatchIsMinimal + + | patch | + patch := self patchSequenceFor: #(a a a b) and: #(a b a a). + self assert: patch size = 5. + self assert: (patch count: [ :each | each key = #match ]) = 3. + self assert: (patch count: [ :each | each key = #insert ]) = 1. + self assert: (patch count: [ :each | each key = #remove ]) = 1. + patch do: [ :each | + each key = #match + ifTrue: [ each value beginsWith: 'a' ] + ifFalse: [ each value beginsWith: 'b' ] ]! Item was added: + ----- Method: TextDiffBuilderTest>>testEmptyLcs2 (in category 'tests') ----- + testEmptyLcs2 + + | patch | + patch := self patchSequenceFor: #() and: #(a b c). + self assert: patch size = 3. + self assert: (patch allSatisfy: [ :each | each key = #insert ])! Item was added: + ----- Method: TextDiffBuilderTest>>testSameSequenceWithRepetitions (in category 'tests') ----- + testSameSequenceWithRepetitions + + | patch | + patch := self patchSequenceFor: #(a a b a) and: #(a a b a). + self assert: patch size = 4. + self assert: (patch allSatisfy: [ :each | each key = #match ])! Item was added: + ----- Method: TextDiffBuilderTest>>patchSequenceFor:and: (in category 'private') ----- + patchSequenceFor: x and: y + + ^(TextDiffBuilder + from: (self convertToString: x) + to: (self convertToString: y)) buildPatchSequence! Item was added: + ----- Method: TextDiffBuilderTest>>testEmptyLcs3 (in category 'tests') ----- + testEmptyLcs3 + + | patch | + patch := self patchSequenceFor: #(a b c) and: #(d e f g). + self assert: patch size = 7. + patch do: [ :each | + each key = #remove ifTrue: [ self assert: ('abc' includes: each value first) ]. + each key = #insert ifTrue: [ self assert: ('defg' includes: each value first) ] ]! Item was added: + ----- Method: TextDiffBuilderTest>>testEmptySequences (in category 'tests') ----- + testEmptySequences + + | patch | + patch := self patchSequenceFor: #() and: #(). + self assert: patch isEmpty! |
Free forum by Nabble | Edit this page |