-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sync: Bring changes from P9 (tests' package)
- Loading branch information
1 parent
07fe833
commit 4305ab1
Showing
5 changed files
with
31 additions
and
24 deletions.
There are no files selected for viewing
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,38 +1,45 @@ | ||
Class { | ||
#name : #HiExamplesTest, | ||
#superclass : #TestCase, | ||
#instVars : [ | ||
'example' | ||
], | ||
#category : #'Hiedra-Tests-Model' | ||
} | ||
|
||
{ #category : #tests } | ||
HiExamplesTest class >> classWithExamplesToTest [ | ||
^ self | ||
] | ||
|
||
{ #category : #testing } | ||
HiExamplesTest class >> isAbstract [ | ||
^ self = HiExamplesTest | ||
] | ||
|
||
{ #category : #tests } | ||
HiExamplesTest >> exampleClassToTest [ | ||
^ self subclassResponsibility | ||
HiExamplesTest class >> testSelectors [ | ||
|
||
^ self classWithExamplesToTest classSide methods | ||
select: [ :each | (each selector beginsWith: 'example') and: [ each numArgs = 0 ] ] | ||
thenCollect: [ :each | each selector ] | ||
|
||
|
||
] | ||
|
||
{ #category : #tests } | ||
HiExamplesTest >> exampleMethods [ | ||
HiExamplesTest class >> whichClassIncludesTestSelector: aSymbol [ | ||
^self classWithExamplesToTest classSide whichClassIncludesSelector: aSymbol | ||
] | ||
|
||
^ self exampleClassToTest classSide methods select: [ :each | | ||
(each selector beginsWith: 'example') and: [ each numArgs = 0 ] ] | ||
{ #category : #private } | ||
HiExamplesTest >> performTest [ | ||
example := self class classWithExamplesToTest perform: testSelector asSymbol | ||
] | ||
|
||
{ #category : #tests } | ||
HiExamplesTest >> testAllExamples [ | ||
| exampleMethods | | ||
|
||
self timeLimit: 1 minute. | ||
|
||
exampleMethods := self exampleMethods. | ||
self deny: exampleMethods isEmpty. | ||
{ #category : #running } | ||
HiExamplesTest >> tearDown [ | ||
|
||
exampleMethods do: [ :each | | anExample | | ||
self | ||
shouldnt: [ anExample := each methodClass instanceSide perform: each selector ] | ||
raise: Error. | ||
anExample ifNotNil: [ anExample close ] ] | ||
example ifNotNil: [ example close ]. | ||
super tearDown | ||
] |
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