Hi—I’m a beginner in Pharo and am working my way through Pharo by Example 5.0 
(PbE) and Learning OOP and TDD with Pharo (LOTWP).

I’m currently going through 7.4 Designing a test, in LOTWP, which covers 
testing whether a string has no repeated characters, adding the method String 
>> isIsogramSet.

GramCheckerTest, a class for testing, has the following methods:

—
isograms
        "list of isograms; used for testing"

        ^ #('pharo' 'pathfinder' 'xavier' 'lumberjacks’)


testAllIsogramSet
        "using each word in list named 'isograms'"

        self isograms do: [ :word | self assert: word isIsogramSet ]
—

Here are my questions:

1) These two methods are defined on the instance side (the Class button is 
*not* selected). If so, what is the receiver when they are used?

2) In testAllIsogramSet, why do you need ‘self’? After all ‘isograms’ is a data 
structure, and its message is ‘do:’

3) As an add-on to 2), what does ‘self’ refer to? The class GramCheckerTest? If 
so, wouldn’t that make testAllIsogramSet a class method? But testAllIsogramSet 
doesn’t appear in the class browser when I click the Class button when the 
Class pane shows GramCheckerTest.

Thanks for any help you might give/point me to regarding this.




Reply via email to