Skip to content

Commit d20378a

Browse files
committed
fixing cookbook
1 parent ab9eba6 commit d20378a

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

Chapters/SUnit/Cookbook.pillar

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -374,22 +374,16 @@ In this example the generated cases will be 9. One per each combination of ==opt
374374
!!! Customising Test
375375

376376
In this section, we show that SUnit offers two hooks to define what a test selector is and how to perform the test.
377-
[[[
378-
HiExamplesTest class >> classWithExamplesToTest
379-
^ self
380-
]]]
381-
382-
[[[
383-
HiExamplesTest class >> isAbstract
384-
^ self = HiExamplesTest
385-
]]]
377+
Imagine that we want to support that class method on a given class returned by ==classWithExamplesToTest== whose selector follow the pattern ==example*== methods are considered at tests.
378+
We can define method ==testSelectors== as follows:
386379

387380
[[[
388381
HiExamplesTest class >> testSelectors [
389-
^ self classWithExamplesToTest classSide methods
390-
select: [ :each | (each selector beginsWith: 'example') and: [ each numArgs = 0 ] ]
382+
^ self classWithExamplesToTest class methods
383+
select: [ :each | (each selector beginsWith: 'example') and: [ each numArgs = 0 ] ]
391384
thenCollect: [ :each | each selector ]
392385
]]]
386+
Then we can redefine the method ==performTest== to example the method on the class itself.
393387

394388
[[[
395389
HiExamplesTest >> performTest

0 commit comments

Comments
 (0)