-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved some messages. Added shortcut for a single assertion.
- Loading branch information
Showing
51 changed files
with
201 additions
and
117 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
...aro-Kernel-Extensions-Tests.package/AssertionCheckerBuilderTest.class/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
I'm a test case for Assertion Checker Builder |
4 changes: 4 additions & 0 deletions
4
...Pharo-Kernel-Extensions-Tests.package/AssertionCheckerBuilderTest.class/instance/setUp.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
initialization | ||
setUp | ||
|
||
checkerBuilder := AssertionCheckerBuilder new |
18 changes: 18 additions & 0 deletions
18
...sions-Tests.package/AssertionCheckerBuilderTest.class/instance/testConditionalChecking.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
tests | ||
testConditionalChecking | ||
|
||
| explanation rowCount | | ||
|
||
explanation := 'A row count must be positive'. | ||
rowCount := -15. | ||
|
||
checkerBuilder | ||
checking: [ :asserter | asserter affirm: [ rowCount notNil ] because: [ self fail ] onSuccess: [ :successAsserter | successAsserter affirm: [ rowCount positive ] because: [ explanation ] ] ]. | ||
|
||
self | ||
should: [ checkerBuilder buildAndCheck ] | ||
raise: AssertionFailed | ||
withExceptionDo: [ :exception | | ||
self | ||
assert: exception messageText equals: explanation; | ||
assertCollection: exception failures hasSameElements: {explanation} ] |
17 changes: 17 additions & 0 deletions
17
...ertionCheckerBuilderTest.class/instance/testConditionalCheckingWhenFirstConditionFails.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
tests | ||
testConditionalCheckingWhenFirstConditionFails | ||
|
||
| explanation rowCount | | ||
|
||
explanation := 'A row count must be positive'. | ||
rowCount := -15. | ||
|
||
checkerBuilder checking: [ :asserter | asserter affirm: [ rowCount positive ] because: explanation onSuccess: [ :successAsserter | self fail ] ]. | ||
|
||
self | ||
should: [ checkerBuilder buildAndCheck ] | ||
raise: AssertionFailed | ||
withExceptionDo: [ :exception | | ||
self | ||
assert: exception messageText equals: explanation; | ||
assertCollection: exception failures hasSameElements: {explanation} ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 7 additions & 4 deletions
11
...s/instance/testSeveralConditionsFailed.st → ...s/instance/testSeveralConditionsFailed.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,22 @@ | ||
tests | ||
testSeveralConditionsFailed | ||
|
||
| mathFailureExplanation collectionSizeFailureExplanation | | ||
| mathFailureExplanation collectionSizeFailureExplanation | | ||
|
||
mathFailureExplanation := 'An obvious math error'. | ||
collectionSizeFailureExplanation := 'An empty collection was not expected'. | ||
checker | ||
checkerBuilder | ||
checking: [ :asserter | | ||
asserter | ||
affirm: [ 1 > 2 ] because: mathFailureExplanation; | ||
affirm: [ #() notEmpty ] because: collectionSizeFailureExplanation ]. | ||
self | ||
should: [ checker check ] | ||
should: [ checkerBuilder buildAndCheck ] | ||
raise: AssertionFailed | ||
withExceptionDo: [ :exception | | ||
self | ||
assert: exception messageText equals: ('<1s>. <2s>' expandMacrosWith: mathFailureExplanation with: collectionSizeFailureExplanation); | ||
assert: exception failures size equals: 2 ] | ||
assertCollection: exception failures | ||
hasSameElements: | ||
{mathFailureExplanation. | ||
collectionSizeFailureExplanation} ] |
14 changes: 14 additions & 0 deletions
14
...ns-Tests.package/AssertionCheckerBuilderTest.class/instance/testSingleConditionFailure.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
tests | ||
testSingleConditionFailure | ||
|
||
| explanation | | ||
|
||
explanation := 'An obvious math error'. | ||
checkerBuilder checking: [ :asserter | asserter affirm: [ 1 > 2 ] because: explanation ]. | ||
self | ||
should: [ checkerBuilder buildAndCheck ] | ||
raise: AssertionFailed | ||
withExceptionDo: [ :exception | | ||
self | ||
assert: exception messageText equals: explanation; | ||
assertCollection: exception failures hasSameElements: {explanation} ] |
4 changes: 4 additions & 0 deletions
4
...-Extensions-Tests.package/AssertionCheckerBuilderTest.class/instance/testWithoutChecks.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
tests | ||
testWithoutChecks | ||
|
||
self shouldnt: [ checkerBuilder buildAndCheck ] raise: AssertionFailed |
4 changes: 2 additions & 2 deletions
4
...est.class/instance/testWithoutFailures.st → ...est.class/instance/testWithoutFailures.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
tests | ||
testWithoutFailures | ||
|
||
checker | ||
checkerBuilder | ||
checking: [ :asserter | | ||
asserter | ||
affirm: [ true ] because: [ self fail ]; | ||
affirm: [ 1 positive ] because: [ self fail ] ]. | ||
|
||
self shouldnt: [ checker check ] raise: AssertionFailed | ||
self shouldnt: [ checkerBuilder buildAndCheck ] raise: AssertionFailed |
16 changes: 16 additions & 0 deletions
16
...o-Kernel-Extensions-Tests.package/AssertionCheckerBuilderTest.class/methodProperties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"instance" : { | ||
"testWithoutFailures" : "GabrielOmarCotelli 1/25/2017 21:28", | ||
"testConditionalChecking" : "GabrielOmarCotelli 1/25/2017 21:33", | ||
"testConditionalCheckingWhenFirstConditionFails" : "GabrielOmarCotelli 1/25/2017 21:34", | ||
"testSeveralConditionsButOnlyOneFailed" : "GabrielOmarCotelli 1/25/2017 21:36", | ||
"testSingleConditionFailure" : "GabrielOmarCotelli 1/25/2017 21:39", | ||
"testFailFastPassingSomeConditions" : "GabrielOmarCotelli 1/25/2017 21:35", | ||
"testFailFastInConditional" : "GabrielOmarCotelli 1/25/2017 21:34", | ||
"testFailFast" : "GabrielOmarCotelli 1/25/2017 21:34", | ||
"testWithoutChecks" : "GabrielOmarCotelli 1/25/2017 21:28", | ||
"testSeveralConditionsFailed" : "GabrielOmarCotelli 1/25/2017 21:36", | ||
"setUp" : "GabrielOmarCotelli 1/25/2017 21:27" | ||
}, | ||
"class" : { } | ||
} |
13 changes: 13 additions & 0 deletions
13
...e/Pharo-Kernel-Extensions-Tests.package/AssertionCheckerBuilderTest.class/properties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"commentStamp" : "GabrielOmarCotelli 1/25/2017 21:30", | ||
"super" : "TestCase", | ||
"category" : "Pharo-Kernel-Extensions-Tests-Assertions", | ||
"classinstvars" : [ ], | ||
"pools" : [ ], | ||
"classvars" : [ ], | ||
"instvars" : [ | ||
"checkerBuilder" | ||
], | ||
"name" : "AssertionCheckerBuilderTest", | ||
"type" : "normal" | ||
} |
2 changes: 1 addition & 1 deletion
2
source/Pharo-Kernel-Extensions-Tests.package/AssertionCheckerTest.class/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
I'm a test case for Assertion Checker | ||
I'm a test case for Assertion Checker |
4 changes: 0 additions & 4 deletions
4
source/Pharo-Kernel-Extensions-Tests.package/AssertionCheckerTest.class/instance/setUp.st
This file was deleted.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
...l-Extensions-Tests.package/AssertionCheckerTest.class/instance/testConditionalChecking.st
This file was deleted.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
...age/AssertionCheckerTest.class/instance/testConditionalCheckingWhenFirstConditionFails.st
This file was deleted.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
...tensions-Tests.package/AssertionCheckerTest.class/instance/testJustCheckOneFactFailing.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
tests | ||
testJustCheckOneFactFailing | ||
|
||
| explanation | | ||
|
||
explanation := 'A false statement'. | ||
self should: [ AssertionChecker justCheck: [ false ] because: explanation ] raise: AssertionFailed withExceptionDo: [ :exception | self assert: exception messageText equals: explanation ] |
4 changes: 4 additions & 0 deletions
4
...sions-Tests.package/AssertionCheckerTest.class/instance/testJustCheckOneFactNotFailing.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
tests | ||
testJustCheckOneFactNotFailing | ||
|
||
self shouldnt: [ AssertionChecker justCheck: [ true ] because: [ self fail ] ] raise: AssertionFailed |
14 changes: 0 additions & 14 deletions
14
...xtensions-Tests.package/AssertionCheckerTest.class/instance/testSingleConditionFailure.st
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
...-Kernel-Extensions-Tests.package/AssertionCheckerTest.class/instance/testWithoutChecks.st
This file was deleted.
Oops, something went wrong.
13 changes: 2 additions & 11 deletions
13
...ce/Pharo-Kernel-Extensions-Tests.package/AssertionCheckerTest.class/methodProperties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,7 @@ | ||
{ | ||
"instance" : { | ||
"testWithoutFailures" : "GabrielOmarCotelli 1/24/2017 21:49", | ||
"testConditionalChecking" : "GabrielOmarCotelli 1/24/2017 21:48", | ||
"testConditionalCheckingWhenFirstConditionFails" : "GabrielOmarCotelli 1/24/2017 21:44", | ||
"testSeveralConditionsButOnlyOneFailed" : "GabrielOmarCotelli 1/24/2017 21:51", | ||
"testSingleConditionFailure" : "GabrielOmarCotelli 1/23/2017 18:59", | ||
"testFailFastPassingSomeConditions" : "GabrielOmarCotelli 1/24/2017 21:51", | ||
"testFailFastInConditional" : "GabrielOmarCotelli 1/24/2017 21:52", | ||
"testFailFast" : "GabrielOmarCotelli 1/24/2017 21:52", | ||
"testWithoutChecks" : "GabrielOmarCotelli 1/23/2017 18:58", | ||
"testSeveralConditionsFailed" : "GabrielOmarCotelli 1/23/2017 18:59", | ||
"setUp" : "GabrielOmarCotelli 1/23/2017 18:58" | ||
"testJustCheckOneFactFailing" : "GabrielOmarCotelli 1/25/2017 22:01", | ||
"testJustCheckOneFactNotFailing" : "GabrielOmarCotelli 1/25/2017 22:00" | ||
}, | ||
"class" : { } | ||
} |
6 changes: 2 additions & 4 deletions
6
source/Pharo-Kernel-Extensions-Tests.package/AssertionCheckerTest.class/properties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,11 @@ | ||
{ | ||
"commentStamp" : "GabrielOmarCotelli 1/23/2017 17:01", | ||
"commentStamp" : "GabrielOmarCotelli 1/25/2017 21:55", | ||
"super" : "TestCase", | ||
"category" : "Pharo-Kernel-Extensions-Tests-Assertions", | ||
"classinstvars" : [ ], | ||
"pools" : [ ], | ||
"classvars" : [ ], | ||
"instvars" : [ | ||
"checker" | ||
], | ||
"instvars" : [ ], | ||
"name" : "AssertionCheckerTest", | ||
"type" : "normal" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
source/Pharo-Kernel-Extensions-Tests.package/AssertionFailedTest.class/methodProperties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"instance" : { | ||
"testFailures" : "GabrielOmarCotelli 1/24/2017 20:01", | ||
"testSignalAll" : "GabrielOmarCotelli 1/24/2017 20:17" | ||
"testSignalAll" : "GabrielOmarCotelli 1/25/2017 21:33" | ||
}, | ||
"class" : { } | ||
} |
2 changes: 1 addition & 1 deletion
2
source/Pharo-Kernel-Extensions-Tests.package/monticello.meta/version
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
(name 'Pharo-Kernel-Extensions-Tests-GabrielOmarCotelli.2' message 'First iteration on assertion model ' id '5f4e6cd7-d444-40b4-9453-b2405bd0d5c2' date '24 January 2017' time '9:54:05.93826 pm' author 'GabrielOmarCotelli' ancestors ((name 'Pharo-Kernel-Extensions-Tests-GabrielOmarCotelli.1' message 'Package rename' id '6cf484ad-1744-434f-8da5-2ad346e54527' date '5 January 2017' time '3:02:49.284866 pm' author 'GabrielOmarCotelli' ancestors () stepChildren ())) stepChildren ()) | ||
(name 'Pharo-Kernel-Extensions-Tests-GabrielOmarCotelli.3' message 'Improved some messages. Added shortcut for a single assertion.' id 'feea69b2-0d07-40ad-ac34-426acb8e2c75' date '25 January 2017' time '10:02:37.949731 pm' author 'GabrielOmarCotelli' ancestors ((name 'Pharo-Kernel-Extensions-Tests-GabrielOmarCotelli.2' message 'First iteration on assertion model ' id '5f4e6cd7-d444-40b4-9453-b2405bd0d5c2' date '24 January 2017' time '9:54:05.93826 pm' author 'GabrielOmarCotelli' ancestors ((name 'Pharo-Kernel-Extensions-Tests-GabrielOmarCotelli.1' message 'Package rename' id '6cf484ad-1744-434f-8da5-2ad346e54527' date '5 January 2017' time '3:02:49.284866 pm' author 'GabrielOmarCotelli' ancestors () stepChildren ())) stepChildren ())) stepChildren ()) |
2 changes: 1 addition & 1 deletion
2
source/Pharo-Kernel-Extensions.package/Asserter.class/instance/affirm.because..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
configuring | ||
affirm: aFact because: aStringOrBlock | ||
|
||
conditions add: (AssertionCheck checking: aFact onFailure: aStringOrBlock) | ||
checks add: (AssertionCheck checking: aFact onFailure: aStringOrBlock) |
Oops, something went wrong.