diff --git a/src/Hiedra-Tests/HiExamplesTest.class.st b/src/Hiedra-Tests/HiExamplesTest.class.st index 978cc46..9a81a14 100644 --- a/src/Hiedra-Tests/HiExamplesTest.class.st +++ b/src/Hiedra-Tests/HiExamplesTest.class.st @@ -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 ] diff --git a/src/Hiedra-Tests/HiFastTableExampleTest.class.st b/src/Hiedra-Tests/HiFastTableExampleTest.class.st index 6419cbb..6d39687 100644 --- a/src/Hiedra-Tests/HiFastTableExampleTest.class.st +++ b/src/Hiedra-Tests/HiFastTableExampleTest.class.st @@ -5,6 +5,6 @@ Class { } { #category : #tests } -HiFastTableExampleTest >> exampleClassToTest [ +HiFastTableExampleTest class >> classWithExamplesToTest [ ^ HiFastTableExample ] diff --git a/src/Hiedra-Tests/HiRulerBuilderTest.class.st b/src/Hiedra-Tests/HiRulerBuilderTest.class.st index b5b2fcc..f0ca98b 100644 --- a/src/Hiedra-Tests/HiRulerBuilderTest.class.st +++ b/src/Hiedra-Tests/HiRulerBuilderTest.class.st @@ -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: { diff --git a/src/Hiedra-Tests/HiRulerTest.class.st b/src/Hiedra-Tests/HiRulerTest.class.st index 6e0e9e0..bad1d93 100644 --- a/src/Hiedra-Tests/HiRulerTest.class.st +++ b/src/Hiedra-Tests/HiRulerTest.class.st @@ -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. diff --git a/src/Hiedra-Tests/HiSpecExampleTest.class.st b/src/Hiedra-Tests/HiSpecExampleTest.class.st index 09581c5..10c6267 100644 --- a/src/Hiedra-Tests/HiSpecExampleTest.class.st +++ b/src/Hiedra-Tests/HiSpecExampleTest.class.st @@ -5,6 +5,6 @@ Class { } { #category : #tests } -HiSpecExampleTest >> exampleClassToTest [ +HiSpecExampleTest class >> classWithExamplesToTest [ ^ HiSpecExample ]