Fixed allSelectorsSent because a simpler implementation was overriding the original.
[cslatevm.git] / tests / regression / wordcount.slate
blobac92fba6512d0a7c190a5ad347931fef9551d2c8
1 RegressionTests addPrototype: #WordCount derivedFrom: {TestCase}.
2 "A regression test playing with the LICENSE file"
4 t@(RegressionTests WordCount traits) testFileName
6   'LICENSE'
7 ].
9 t@(RegressionTests WordCount traits) testWordCount
10 [| words |
11   words: Bag new.
12   (File newNamed: t testFileName &mode: File Read) sessionDo:
13     [| :file |
14       file reader split >> words writer.
15     ].
16   "Console ; 'Number of different words ' ; (words size as: String) ; '\n'."
17   t assert: words size = 170 description: 'The number of words found in the LICENSE file is not as expected.'.
20 t@(RegressionTests WordCount traits) testLineCount
21 "Note that empty lines will be ignored by #splitWith: "
22 [| lineCount |
23   lineCount: 0.
24   (File newNamed: t testFileName &mode: File Read) sessionDo:
25     [| :file |
26       (file reader splitWith: { $\n }) do:
27         [| :line | lineCount: lineCount succ].
28     ].
29   "Console ; 'Number of lines ' ; (lineCount as: String) ; '\n'."
30   t assert: lineCount = 16 description: 'The number of lines found in the LICENSE file is not as expected.'.
33 t@(RegressionTests WordCount traits) suite
34 [t suiteForSelectors: {
35   #testLineCount.
36   #testWordCount.
37 }].