Frank Shearar uploaded a new version of ToolsTests to project The Trunk:
http://source.squeak.org/trunk/ToolsTests-fbs.63.mcz ==================== Summary ==================== Name: ToolsTests-fbs.63 Author: fbs Time: 21 May 2013, 11:01:03.232 pm UUID: e4188f34-fa59-4518-88d5-eb6042ee51b6 Ancestors: ToolsTests-fbs.62 MethodReference new setStandardClass: foo methodSymbol: bar -> MethodReference class: foo selector: bar. Tests! =============== Diff against ToolsTests-fbs.62 =============== Item was added: + ----- Method: MethodReferenceTest>>testClassSelectorDefaultsToSmalltalkGlobals (in category 'tests') ----- + testClassSelectorDefaultsToSmalltalkGlobals + | mref | + mref := MethodReference class: self class selector: #testClassSelectorDefaultsToSmalltalkGlobals. + self assert: Smalltalk globals equals: mref environment.! Item was changed: ----- Method: MethodReferenceTest>>testEquals (in category 'Running') ----- testEquals | aMethodReference anotherMethodReference | aMethodReference := MethodReference new. anotherMethodReference := MethodReference new. + "Two fresh instances should be equals between them" + self assert: MethodReference new equals: MethodReference new. + self assert: MethodReference new hash equals: MethodReference new hash. + + "Two instances representing the same method (same class and - " - two fresh instances should be equals between them" - self - should: [aMethodReference = anotherMethodReference]. - self - should: [aMethodReference hash = anotherMethodReference hash]. - " - two instances representing the same method (same class and same selector) should be equals" + self assert: (MethodReference class: String selector: #foo) equals: (MethodReference class: String selector: #foo). + self assert: (MethodReference class: String selector: #foo) hash equals: (MethodReference class: String selector: #foo) hash.! - aMethodReference setStandardClass: String methodSymbol: #foo. - anotherMethodReference setStandardClass: String methodSymbol: #foo. - self - should: [aMethodReference = anotherMethodReference]. - self - should: [aMethodReference hash = anotherMethodReference hash] ! Item was changed: ----- Method: MethodReferenceTest>>testNotEquals (in category 'Running') ----- testNotEquals - | aMethodReference anotherMethodReference | - aMethodReference := MethodReference new. - anotherMethodReference := MethodReference new. - "" - aMethodReference setStandardClass: String methodSymbol: #foo. - anotherMethodReference setStandardClass: String class methodSymbol: #foo. - " - differente classes, same selector -> no more equals" self + deny: (MethodReference class: String selector: #foo) = (MethodReference class: String class selector: #foo) + description: 'Different classes, same selector -> no more equals'. - shouldnt: [aMethodReference = anotherMethodReference]. - " - same classes, diferente selector -> no more equals" - anotherMethodReference setStandardClass: String methodSymbol: #bar. self + deny: (MethodReference class: String selector: #foo) = (MethodReference class: String selector: #bar) + description: 'Same class, different selectors -> no more equals'.! - shouldnt: [aMethodReference = anotherMethodReference] ! |
Free forum by Nabble | Edit this page |