The Trunk: SUnit-fbs.99.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: SUnit-fbs.99.mcz

commits-2
Frank Shearar uploaded a new version of SUnit to project The Trunk:
http://source.squeak.org/trunk/SUnit-fbs.99.mcz

==================== Summary ====================

Name: SUnit-fbs.99
Author: fbs
Time: 9 January 2014, 2:05:18.527 pm
UUID: a5be81dd-6e9f-8d41-a091-3c6c27a28abe
Ancestors: SUnit-cmm.98

Basic #assert:identical: implementation.

Suggestions for a better error message welcome!

=============== Diff against SUnit-cmm.98 ===============

Item was added:
+ ----- Method: SUnitTest>>testAssertIdentical (in category 'testing') -----
+ testAssertIdentical
+ | a b |
+ a := 'foo'.
+ b := 'bar'.
+ self should: [self assert: a identical: b] raise: TestFailure.
+ [self assert: a identical: b] on: TestFailure do: [:e | |error|
+ error := e messageText.
+ self assert: (error includesSubString: a) description: 'Error message doesn''t include the expected value'.
+ self assert: (error includesSubString: b) description: 'Error message doesn''t include the expected value'].!

Item was added:
+ ----- Method: SUnitTest>>testAssertIdenticalDescription (in category 'testing') -----
+ testAssertIdenticalDescription
+ | a b |
+ a := 'foo'.
+ b := a copy.
+ self should: [self assert: a identical: b description: 'A desciption'] raise: TestFailure.
+ [self assert: a identical: b description: 'A desciption'] on: TestFailure do: [:e | |error|
+ error := e messageText.
+ self assert: (error includesSubString: 'A desciption') description: 'Error message doesn''t give you the description'].!

Item was added:
+ ----- Method: SUnitTest>>testAssertIdenticalWithEqualObjects (in category 'testing') -----
+ testAssertIdenticalWithEqualObjects
+ | a b |
+ a := 'foo'.
+ b := a copy.
+ self should: [self assert: a identical: b] raise: TestFailure.
+ [self assert: a identical: b] on: TestFailure do: [:e | |error|
+ error := e messageText.
+ self assert: (error includesSubString: 'not identical') description: 'Error message doesn''t say the two things aren''t identical'].!

Item was added:
+ ----- Method: TestCase>>assert:identical: (in category 'accessing') -----
+ assert: expected identical: actual
+
+ ^self
+ assert: expected == actual
+ description: [ self comparingStringBetweenIdentical: expected and: actual ]
+ !

Item was added:
+ ----- Method: TestCase>>assert:identical:description: (in category 'accessing') -----
+ assert: expected identical: actual description: aString
+
+ ^self
+ assert: expected == actual
+ description: [ aString , ': ', (self comparingStringBetweenIdentical: expected and: actual) ]!

Item was added:
+ ----- Method: TestCase>>comparingStringBetweenIdentical:and: (in category 'private') -----
+ comparingStringBetweenIdentical: expected and: actual
+ ^ 'Expected {1} and actual {2} are not identical.' format: {
+ expected printStringLimitedTo: 10.
+ actual printStringLimitedTo: 10.
+ }!