Skip to content

Commit

Permalink
Sync: Bring changes from P9 (tests' package)
Browse files Browse the repository at this point in the history
  • Loading branch information
tinchodias committed Nov 30, 2020
1 parent 07fe833 commit 4305ab1
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 24 deletions.
43 changes: 25 additions & 18 deletions src/Hiedra-Tests/HiExamplesTest.class.st
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
]
2 changes: 1 addition & 1 deletion src/Hiedra-Tests/HiFastTableExampleTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ Class {
}

{ #category : #tests }
HiFastTableExampleTest >> exampleClassToTest [
HiFastTableExampleTest class >> classWithExamplesToTest [
^ HiFastTableExample
]
6 changes: 3 additions & 3 deletions src/Hiedra-Tests/HiRulerBuilderTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,9 @@ HiRulerBuilderTest >> testTwoMergedForks [
"

self buildRulerWith: {
#c -> #(a b).
#b -> #(a).
#a -> #().
#c -> #(a b) copy.
#b -> #(a) copy.
#a -> #() copy.
}.

self assertRulerHasNodes: {
Expand Down
2 changes: 1 addition & 1 deletion src/Hiedra-Tests/HiRulerTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ HiRulerTest >> testTwoMergedForks [
"

| ruler c b a |
ruler := HiRuler withValues: #(c b a).
ruler := HiRuler withValues: #(c b a) copy.

c := ruler addNodeFor: #c.
a := ruler addNodeFor: #a.
Expand Down
2 changes: 1 addition & 1 deletion src/Hiedra-Tests/HiSpecExampleTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ Class {
}

{ #category : #tests }
HiSpecExampleTest >> exampleClassToTest [
HiSpecExampleTest class >> classWithExamplesToTest [
^ HiSpecExample
]

0 comments on commit 4305ab1

Please sign in to comment.