SystemOrganization addCategory: #'TextLint-Tests-Model'! SystemOrganization addCategory: #'TextLint-Tests-Parser'! SystemOrganization addCategory: #'TextLint-Tests-Runner'! SystemOrganization addCategory: #'TextLint-Tests-Rules'! TestCase subclass: #TLALotRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLALotRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 11:40'! testFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'A')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (TLWord with: (PPToken on: 'lot')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLALotRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first text = 'A'. self assert: results first element words last text = 'lot'. self assert: results first rule = aRule. ! ! !TLALotRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 11:41'! testFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'A')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (TLWord with: (PPToken on: 'LOT')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLALotRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first text = 'A'. self assert: results first element words last text = 'LOT'. self assert: results first rule = aRule. ! ! !TLALotRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 11:42'! testFailureInSentence | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'a')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (TLWord with: (PPToken on: 'Lot')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLALotRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first text = 'a'. self assert: results first element words last text = 'Lot'. self assert: results first rule = aRule. ! ! !TLALotRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/13/2010 10:18'! testSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'lot')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLALotRule new. results := aRule runOn: aDocument. self assert: results isEmpty. ! ! TestCase subclass: #TLARuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLARuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 17:01'! testFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. word1 := words add: (TLWord with: (PPToken on: 'A')). words add: (TLWhitespace with: (PPToken on: ' ')). word2 := words add: (TLWord with: (PPToken on: 'ot')). words add: (TLWord with: (PPToken on: 'that')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLARule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first = word1. self assert: results first element words last = word2. self assert: results first rule = aRule. ! ! !TLARuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 17:07'! testFailureA | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. word1 := words add: (TLWord with: (PPToken on: 'A')). words add: (TLWhitespace with: (PPToken on: ' ')). word2 := words add: (TLWord with: (PPToken on: 'AT')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLARule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first = word1. self assert: results first element words last = word2. self assert: results first rule = aRule. ! ! !TLARuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 17:09'! testFailureE | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. word1 := words add: (TLWord with: (PPToken on: 'A')). words add: (TLWhitespace with: (PPToken on: ' ')). word2 := words add: (TLWord with: (PPToken on: 'ET')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLARule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first = word1. self assert: results first element words last = word2. self assert: results first rule = aRule. ! ! !TLARuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 17:09'! testFailureI | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. word1 := words add: (TLWord with: (PPToken on: 'A')). words add: (TLWhitespace with: (PPToken on: ' ')). word2 := words add: (TLWord with: (PPToken on: 'IT')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLARule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first = word1. self assert: results first element words last = word2. self assert: results first rule = aRule. ! ! !TLARuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 17:10'! testFailureO | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. word1 := words add: (TLWord with: (PPToken on: 'A')). words add: (TLWhitespace with: (PPToken on: ' ')). word2 := words add: (TLWord with: (PPToken on: 'OT')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLARule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first = word1. self assert: results first element words last = word2. self assert: results first rule = aRule. ! ! !TLARuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 17:10'! testFailureU | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. word1 := words add: (TLWord with: (PPToken on: 'A')). words add: (TLWhitespace with: (PPToken on: ' ')). word2 := words add: (TLWord with: (PPToken on: 'UT')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLARule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first = word1. self assert: results first element words last = word2. self assert: results first rule = aRule. ! ! !TLARuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 17:10'! testFailurea | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. word1 := words add: (TLWord with: (PPToken on: 'A')). words add: (TLWhitespace with: (PPToken on: ' ')). word2 := words add: (TLWord with: (PPToken on: 'at')). words add: (TLWord with: (PPToken on: 'that')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLARule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first = word1. self assert: results first element words last = word2. self assert: results first rule = aRule. ! ! !TLARuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 17:10'! testFailuree | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. word1 := words add: (TLWord with: (PPToken on: 'A')). words add: (TLWhitespace with: (PPToken on: ' ')). word2 := words add: (TLWord with: (PPToken on: 'et')). words add: (TLWord with: (PPToken on: 'that')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLARule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first = word1. self assert: results first element words last = word2. self assert: results first rule = aRule. ! ! !TLARuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 17:11'! testFailurei | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. word1 := words add: (TLWord with: (PPToken on: 'A')). words add: (TLWhitespace with: (PPToken on: ' ')). word2 := words add: (TLWord with: (PPToken on: 'it')). words add: (TLWord with: (PPToken on: 'that')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLARule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first = word1. self assert: results first element words last = word2. self assert: results first rule = aRule. ! ! !TLARuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 17:11'! testFailureo | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. word1 := words add: (TLWord with: (PPToken on: 'A')). words add: (TLWhitespace with: (PPToken on: ' ')). word2 := words add: (TLWord with: (PPToken on: 'ot')). words add: (TLWord with: (PPToken on: 'that')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLARule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first = word1. self assert: results first element words last = word2. self assert: results first rule = aRule. ! ! !TLARuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 17:11'! testFailureu | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. word1 := words add: (TLWord with: (PPToken on: 'A')). words add: (TLWhitespace with: (PPToken on: ' ')). word2 := words add: (TLWord with: (PPToken on: 'ut')). words add: (TLWord with: (PPToken on: 'that')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLARule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first = word1. self assert: results first element words last = word2. self assert: results first rule = aRule. ! ! !TLARuleTest methodsFor: 'test' stamp: 'JorgeRessia 9/3/2010 11:47'! testOne | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'a')). words add: (TLWhitespace new). words add: (TLWord with: (PPToken on: 'one')). words add: (TLWord with: (PPToken on: 'lot')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLARule new. results := aRule runOn: aDocument. self assert: results isEmpty. ! ! !TLARuleTest methodsFor: 'test' stamp: 'JorgeRessia 9/3/2010 11:48'! testUS | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'a')). words add: (TLWhitespace new). words add: (TLWord with: (PPToken on: 'US')). words add: (TLWord with: (PPToken on: 'lot')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLARule new. results := aRule runOn: aDocument. self assert: results isEmpty. ! ! !TLARuleTest methodsFor: 'test' stamp: 'JorgeRessia 9/3/2010 11:48'! testUnified | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'a')). words add: (TLWhitespace new). words add: (TLWord with: (PPToken on: 'unified')). words add: (TLWord with: (PPToken on: 'lot')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLARule new. results := aRule runOn: aDocument. self assert: results isEmpty. ! ! !TLARuleTest methodsFor: 'test' stamp: 'JorgeRessia 9/3/2010 11:48'! testUniform | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'a')). words add: (TLWhitespace new). words add: (TLWord with: (PPToken on: 'uniform')). words add: (TLWord with: (PPToken on: 'lot')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLARule new. results := aRule runOn: aDocument. self assert: results isEmpty. ! ! !TLARuleTest methodsFor: 'test' stamp: 'JorgeRessia 9/3/2010 11:48'! testUnifying | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'a')). words add: (TLWhitespace new). words add: (TLWord with: (PPToken on: 'unifying')). words add: (TLWord with: (PPToken on: 'lot')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLARule new. results := aRule runOn: aDocument. self assert: results isEmpty. ! ! !TLARuleTest methodsFor: 'test' stamp: 'JorgeRessia 9/3/2010 11:48'! testUnion | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'a')). words add: (TLWhitespace new). words add: (TLWord with: (PPToken on: 'union')). words add: (TLWord with: (PPToken on: 'lot')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLARule new. results := aRule runOn: aDocument. self assert: results isEmpty. ! ! !TLARuleTest methodsFor: 'test' stamp: 'JorgeRessia 9/3/2010 11:48'! testUnique | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'a')). words add: (TLWhitespace new). words add: (TLWord with: (PPToken on: 'unique')). words add: (TLWord with: (PPToken on: 'lot')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLARule new. results := aRule runOn: aDocument. self assert: results isEmpty. ! ! !TLARuleTest methodsFor: 'test' stamp: 'JorgeRessia 9/3/2010 11:48'! testUnit | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'a')). words add: (TLWhitespace new). words add: (TLWord with: (PPToken on: 'unit')). words add: (TLWord with: (PPToken on: 'lot')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLARule new. results := aRule runOn: aDocument. self assert: results isEmpty. ! ! !TLARuleTest methodsFor: 'test' stamp: 'JorgeRessia 9/3/2010 11:48'! testUnited | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'a')). words add: (TLWhitespace new). words add: (TLWord with: (PPToken on: 'united')). words add: (TLWord with: (PPToken on: 'lot')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLARule new. results := aRule runOn: aDocument. self assert: results isEmpty. ! ! !TLARuleTest methodsFor: 'test' stamp: 'JorgeRessia 9/3/2010 11:48'! testUniversal | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'a')). words add: (TLWhitespace new). words add: (TLWord with: (PPToken on: 'universal')). words add: (TLWord with: (PPToken on: 'lot')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLARule new. results := aRule runOn: aDocument. self assert: results isEmpty. ! ! !TLARuleTest methodsFor: 'test' stamp: 'JorgeRessia 9/3/2010 11:48'! testUsage | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'a')). words add: (TLWhitespace new). words add: (TLWord with: (PPToken on: 'usage')). words add: (TLWord with: (PPToken on: 'lot')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLARule new. results := aRule runOn: aDocument. self assert: results isEmpty. ! ! !TLARuleTest methodsFor: 'test' stamp: 'JorgeRessia 9/3/2010 11:48'! testUseful | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'a')). words add: (TLWhitespace new). words add: (TLWord with: (PPToken on: 'useful')). words add: (TLWord with: (PPToken on: 'lot')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLARule new. results := aRule runOn: aDocument. self assert: results isEmpty. ! ! !TLARuleTest methodsFor: 'test' stamp: 'JorgeRessia 9/3/2010 11:47'! testUser | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'a')). words add: (TLWhitespace new). words add: (TLWord with: (PPToken on: 'user')). words add: (TLWord with: (PPToken on: 'lot')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLARule new. results := aRule runOn: aDocument. self assert: results isEmpty. ! ! TestCase subclass: #TLAllowToRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLAllowToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 11:46'! testAllowToFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results| words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'Allow')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (TLWord with: (PPToken on: 'to')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAllowToRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first text = 'Allow'. self assert: results first element words last text = 'to'. self assert: results first rule = aRule. ! ! !TLAllowToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 11:46'! testAllowToFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results| words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'Allow')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (TLWord with: (PPToken on: 'TO')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAllowToRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first text = 'Allow'. self assert: results first element words last text = 'TO'. self assert: results first rule = aRule. ! ! !TLAllowToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 11:47'! testAllowToFailureInSentence | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'Allow')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (TLWord with: (PPToken on: 'to')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAllowToRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first text = 'Allow'. self assert: results first element words last text = 'to'. self assert: results first rule = aRule. ! ! !TLAllowToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 11:54'! testAllowToSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'allow')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAllowToRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! !TLAllowToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 11:47'! testAllowsToFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'Allows')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (TLWord with: (PPToken on: 'to')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAllowToRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first text = 'Allows'. self assert: results first element words last text = 'to'. self assert: results first rule = aRule. ! ! !TLAllowToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 11:47'! testAllowsToFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'ALLOWS')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (TLWord with: (PPToken on: 'TO')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAllowToRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first text = 'ALLOWS'. self assert: results first element words last text = 'TO'. self assert: results first rule = aRule. ! ! !TLAllowToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 11:48'! testAllowsToFailureInSentence | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'Allows')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (TLWord with: (PPToken on: 'to')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAllowToRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first text = 'Allows'. self assert: results first element words last text = 'to'. self assert: results first rule = aRule. ! ! !TLAllowToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/9/2010 18:00'! testAllowsToSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'allows')). words add: (TLWord with: (PPToken on: ' ')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAllowToRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! TestCase subclass: #TLAnRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLAnRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 20:40'! testFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. word1 := words add: (TLWord with: (PPToken on: 'An')). words add: (TLWhitespace with: (PPToken on: ' ')). word2 := words add: (TLWord with: (PPToken on: 't')). words add: (TLWord with: (PPToken on: 'that')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAnRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first = word1. self assert: results first element words last = word2. self assert: results first rule = aRule. ! ! !TLAnRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 20:40'! testFailureA | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. word1 := words add: (TLWord with: (PPToken on: 'A')). words add: (TLWhitespace with: (PPToken on: ' ')). word2 := words add: (TLWord with: (PPToken on: 'AT')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAnRule new. results := aRule runOn: aDocument. self assert: results isEmpty. ! ! !TLAnRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 20:41'! testFailureE | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. word1 := words add: (TLWord with: (PPToken on: 'A')). words add: (TLWhitespace with: (PPToken on: ' ')). word2 := words add: (TLWord with: (PPToken on: 'ET')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAnRule new. results := aRule runOn: aDocument. self assert: results isEmpty. ! ! !TLAnRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 20:41'! testFailureI | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. word1 := words add: (TLWord with: (PPToken on: 'A')). words add: (TLWhitespace with: (PPToken on: ' ')). word2 := words add: (TLWord with: (PPToken on: 'IT')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAnRule new. results := aRule runOn: aDocument. self assert: results isEmpty. ! ! !TLAnRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 20:41'! testFailureO | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. word1 := words add: (TLWord with: (PPToken on: 'A')). words add: (TLWhitespace with: (PPToken on: ' ')). word2 := words add: (TLWord with: (PPToken on: 'OT')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAnRule new. results := aRule runOn: aDocument. self assert: results isEmpty. ! ! !TLAnRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 20:41'! testFailureU | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. word1 := words add: (TLWord with: (PPToken on: 'A')). words add: (TLWhitespace with: (PPToken on: ' ')). word2 := words add: (TLWord with: (PPToken on: 'UT')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAnRule new. results := aRule runOn: aDocument. self assert: results isEmpty. ! ! !TLAnRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 20:41'! testFailurea | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. word1 := words add: (TLWord with: (PPToken on: 'A')). words add: (TLWhitespace with: (PPToken on: ' ')). word2 := words add: (TLWord with: (PPToken on: 'at')). words add: (TLWord with: (PPToken on: 'that')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAnRule new. results := aRule runOn: aDocument. self assert: results isEmpty. ! ! !TLAnRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 20:41'! testFailuree | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. word1 := words add: (TLWord with: (PPToken on: 'A')). words add: (TLWhitespace with: (PPToken on: ' ')). word2 := words add: (TLWord with: (PPToken on: 'et')). words add: (TLWord with: (PPToken on: 'that')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAnRule new. results := aRule runOn: aDocument. self assert: results isEmpty. ! ! !TLAnRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 20:41'! testFailurei | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. word1 := words add: (TLWord with: (PPToken on: 'A')). words add: (TLWhitespace with: (PPToken on: ' ')). word2 := words add: (TLWord with: (PPToken on: 'it')). words add: (TLWord with: (PPToken on: 'that')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAnRule new. results := aRule runOn: aDocument. self assert: results isEmpty. ! ! !TLAnRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 20:42'! testFailureo | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. word1 := words add: (TLWord with: (PPToken on: 'A')). words add: (TLWhitespace with: (PPToken on: ' ')). word2 := words add: (TLWord with: (PPToken on: 'ot')). words add: (TLWord with: (PPToken on: 'that')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAnRule new. results := aRule runOn: aDocument. self assert: results isEmpty. ! ! !TLAnRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 20:42'! testFailureu | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. word1 := words add: (TLWord with: (PPToken on: 'A')). words add: (TLWhitespace with: (PPToken on: ' ')). word2 := words add: (TLWord with: (PPToken on: 'ut')). words add: (TLWord with: (PPToken on: 'that')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAnRule new. results := aRule runOn: aDocument. self assert: results isEmpty. ! ! !TLAnRuleTest methodsFor: 'test' stamp: 'JorgeRessia 9/3/2010 11:57'! testHonest | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'an')). words add: (TLWhitespace new). words add: (TLWord with: (PPToken on: 'honest')). words add: (TLWord with: (PPToken on: 'lot')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAnRule new. results := aRule runOn: aDocument. self assert: results isEmpty. ! ! !TLAnRuleTest methodsFor: 'test' stamp: 'JorgeRessia 9/3/2010 11:57'! testHonorable | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'an')). words add: (TLWhitespace new). words add: (TLWord with: (PPToken on: 'honorable')). words add: (TLWord with: (PPToken on: 'lot')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAnRule new. results := aRule runOn: aDocument. self assert: results isEmpty. ! ! !TLAnRuleTest methodsFor: 'test' stamp: 'JorgeRessia 9/3/2010 11:57'! testHour | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'an')). words add: (TLWhitespace new). words add: (TLWord with: (PPToken on: 'hour')). words add: (TLWord with: (PPToken on: 'lot')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAnRule new. results := aRule runOn: aDocument. self assert: results isEmpty. ! ! !TLAnRuleTest methodsFor: 'test' stamp: 'JorgeRessia 9/3/2010 11:57'! testHtml | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'an')). words add: (TLWhitespace new). words add: (TLWord with: (PPToken on: 'html')). words add: (TLWord with: (PPToken on: 'lot')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAnRule new. results := aRule runOn: aDocument. self assert: results isEmpty. ! ! !TLAnRuleTest methodsFor: 'test' stamp: 'JorgeRessia 9/3/2010 11:57'! testHttp | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'an')). words add: (TLWhitespace new). words add: (TLWord with: (PPToken on: 'http')). words add: (TLWord with: (PPToken on: 'lot')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAnRule new. results := aRule runOn: aDocument. self assert: results isEmpty. ! ! !TLAnRuleTest methodsFor: 'test' stamp: 'JorgeRessia 9/3/2010 11:57'! testHybrid | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'an')). words add: (TLWhitespace new). words add: (TLWord with: (PPToken on: 'hybrid')). words add: (TLWord with: (PPToken on: 'lot')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAnRule new. results := aRule runOn: aDocument. self assert: results isEmpty. ! ! !TLAnRuleTest methodsFor: 'test' stamp: 'JorgeRessia 9/3/2010 11:57'! testSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'an')). words add: (TLWhitespace new). words add: (TLWord with: (PPToken on: 'est')). words add: (TLWord with: (PPToken on: 'lot')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAnRule new. results := aRule runOn: aDocument. self assert: results isEmpty. ! ! !TLAnRuleTest methodsFor: 'test' stamp: 'JorgeRessia 9/3/2010 11:58'! testXML | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'an')). words add: (TLWhitespace new). words add: (TLWord with: (PPToken on: 'xml')). words add: (TLWord with: (PPToken on: 'lot')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAnRule new. results := aRule runOn: aDocument. self assert: results isEmpty. ! ! TestCase subclass: #TLAnyNumberOfOcurrenciesPatternTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLAnyNumberOfOcurrenciesPatternTest methodsFor: 'test' stamp: 'lr 5/30/2010 20:13'! testConsumeFrom | aPattern aWord anotherWord elements aPhrase aWhitespace anIndexedElement | aPattern := TLAnyNumberOfOccurrencesPattern of: (TLWord with: (PPToken on: 'allow')). elements := OrderedCollection new. elements add: (TLWord with: (PPToken on: 'allow')). elements add: (aWhitespace := TLWhitespace with: (PPToken on: ' ')). elements add: (TLWord with: (PPToken on: 'to')). aPhrase := TLPhrase withAll: elements. anIndexedElement := TLIndexedElement of: aPhrase. aPattern consumeFrom: anIndexedElement . self assert: (anIndexedElement instVarNamed: 'index') = 2. self assert: anIndexedElement current = aWhitespace ! ! !TLAnyNumberOfOcurrenciesPatternTest methodsFor: 'test' stamp: 'lr 5/30/2010 20:12'! testConsumeFromMultiple | aPattern aWord anotherWord elements aPhrase aWhitespace anIndexedElement | aPattern := TLAnyNumberOfOccurrencesPattern of: (TLWord with: (PPToken on: 'allow')). elements := OrderedCollection new. elements add: (TLWord with: (PPToken on: 'allow')). elements add: (TLWord with: (PPToken on: 'allow')). elements add: (aWhitespace := TLWhitespace with: (PPToken on: ' ')). elements add: (TLWord with: (PPToken on: 'to')). aPhrase := TLPhrase withAll: elements. anIndexedElement := TLIndexedElement of: aPhrase. aPattern consumeFrom: anIndexedElement . self assert: (anIndexedElement instVarNamed: 'index') = 3. self assert: anIndexedElement current = aWhitespace ! ! !TLAnyNumberOfOcurrenciesPatternTest methodsFor: 'test' stamp: 'lr 5/30/2010 20:12'! testCreation | aPattern aWord anotherWord elements aPhrase | aPattern := TLAnyNumberOfOccurrencesPattern of: 1. self assert: (aPattern instVarNamed: 'element' ) = 1. ! ! TestCase subclass: #TLAnyOfSetPatternTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLAnyOfSetPatternTest methodsFor: 'test' stamp: 'JorgeRessia 4/12/2010 21:04'! testConsumeFrom | aPattern aWord anotherWord elements aPhrase aWhitespace anIndexedElement aSet | elements := OrderedCollection new. elements add: (TLWord with: (PPToken on: 'allow')). elements add: (aWhitespace := TLWhitespace with: (PPToken on: ' ')). elements add: (TLWord with: (PPToken on: 'to')). aPhrase := TLPhrase withAll: elements. anIndexedElement := TLIndexedElement of: aPhrase. aSet := OrderedCollection with: (TLWord with: (PPToken on: 'allow')) with: (TLWord with: (PPToken on: 'allows')). aPattern := TLAnyOfSetPattern of: aSet. self assert: (aPattern consumeFrom: anIndexedElement ). self assert: anIndexedElement current = aWhitespace ! ! !TLAnyOfSetPatternTest methodsFor: 'test' stamp: 'JorgeRessia 4/12/2010 21:02'! testCreation | aPattern aWord anotherWord elements aPhrase | aPattern := TLAnyOfSetPattern of: 1. self assert: (aPattern instVarNamed: 'elements' ) = 1. ! ! TestCase subclass: #TLAnyWordPatternTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLAnyWordPatternTest methodsFor: 'tests' stamp: 'JorgeRessia 5/26/2010 16:01'! testConsumeFrom | aPattern aWord anotherWord elements aPhrase aWhitespace anIndexedElement aSet | elements := OrderedCollection new. elements add: (TLWord with: (PPToken on: 'allow')). elements add: (aWhitespace := TLWhitespace with: (PPToken on: ' ')). elements add: (TLWord with: (PPToken on: 'to')). aPhrase := TLPhrase withAll: elements. anIndexedElement := TLIndexedElement of: aPhrase. aPattern := TLAnyWordPattern new. self assert: (aPattern consumeFrom: anIndexedElement ). self assert: anIndexedElement current = aWhitespace ! ! TestCase subclass: #TLAsToWhetherRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLAsToWhetherRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 11:54'! testFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'As')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (TLWord with: (PPToken on: 'to')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (TLWord with: (PPToken on: 'whether')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAsToWhetherRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first text = 'As'. self assert: results first element words second text = 'to'. self assert: results first element words last text = 'whether'. self assert: results first rule = aRule. ! ! !TLAsToWhetherRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 11:55'! testFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'AS')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (TLWord with: (PPToken on: 'TO')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (TLWord with: (PPToken on: 'WHETHER')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAsToWhetherRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first text = 'AS'. self assert: results first element words second text = 'TO'. self assert: results first element words last text = 'WHETHER'. self assert: results first rule = aRule. ! ! !TLAsToWhetherRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 11:56'! testFailureInSentence | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'as')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (TLWord with: (PPToken on: 'to')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (TLWord with: (PPToken on: 'Whether')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAsToWhetherRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first text = 'as'. self assert: results first element words second text = 'to'. self assert: results first element words last text = 'Whether'. self assert: results first rule = aRule. ! ! !TLAsToWhetherRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 11:55'! testSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'to')). words add: (TLWord with: (PPToken on: 'whether')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAsToWhetherRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! TestCase subclass: #TLAvoidQualifiersRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLAvoidQualifiersRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 12:04'! testCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | aWord := TLWord with: (PPToken on: 'Rather'). anotherWord := TLWord with: (PPToken on: 'test'). words := OrderedCollection with: aWord with: anotherWord. aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAvoidQualifiersRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLAvoidQualifiersRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 12:04'! testLittleFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | aWord := TLWord with: (PPToken on: 'little'). anotherWord := TLWord with: (PPToken on: 'test'). words := OrderedCollection with: aWord with: anotherWord. aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAvoidQualifiersRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLAvoidQualifiersRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 12:04'! testPrettyFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | aWord := TLWord with: (PPToken on: 'pretty'). anotherWord := TLWord with: (PPToken on: 'test'). words := OrderedCollection with: aWord with: anotherWord. aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAvoidQualifiersRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLAvoidQualifiersRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 12:04'! testQuiteFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | aWord := TLWord with: (PPToken on: 'quite'). anotherWord := TLWord with: (PPToken on: 'test'). words := OrderedCollection with: aWord with: anotherWord. aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAvoidQualifiersRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLAvoidQualifiersRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 12:04'! testRatherFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | aWord := TLWord with: (PPToken on: 'rather'). anotherWord := TLWord with: (PPToken on: 'test'). words := OrderedCollection with: aWord with: anotherWord. aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAvoidQualifiersRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLAvoidQualifiersRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 12:04'! testReallyFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | aWord := TLWord with: (PPToken on: 'really'). anotherWord := TLWord with: (PPToken on: 'test'). words := OrderedCollection with: aWord with: anotherWord. aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAvoidQualifiersRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLAvoidQualifiersRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 11:56'! testSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | aWord := TLWord with: (PPToken on: 'test'). anotherWord := TLWord with: (PPToken on: 'test'). words := OrderedCollection with: aWord with: anotherWord. aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAvoidQualifiersRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! !TLAvoidQualifiersRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 12:04'! testVeryFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | aWord := TLWord with: (PPToken on: 'very'). anotherWord := TLWord with: (PPToken on: 'test'). words := OrderedCollection with: aWord with: anotherWord. aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAvoidQualifiersRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! TestCase subclass: #TLCannotRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLCannotRuleTest methodsFor: 'test' stamp: 'JorgeRessia 6/30/2010 15:01'! testFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'CAN')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'not')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLCannotRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first = word1. self assert: results first element words last = word2. self assert: results first rule = aRule. ! ! !TLCannotRuleTest methodsFor: 'test' stamp: 'JorgeRessia 6/30/2010 15:04'! testFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'Can')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'NOT')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLCannotRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first = word1. self assert: results first element words last = word2. self assert: results first rule = aRule. ! ! !TLCannotRuleTest methodsFor: 'test' stamp: 'JorgeRessia 6/30/2010 15:05'! testFailureInSentence | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (word1 := TLWord with: (PPToken on: 'can')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'not')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLCannotRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first = word1. self assert: results first element words last = word2. self assert: results first rule = aRule. ! ! !TLCannotRuleTest methodsFor: 'test' stamp: 'JorgeRessia 6/30/2010 15:02'! testSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'can')). words add: (TLWord with: (PPToken on: 'lot')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLCannotRule new. results := aRule runOn: aDocument. self assert: results isEmpty. ! ! TestCase subclass: #TLCaseInsensitiveWordPatternTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLCaseInsensitiveWordPatternTest methodsFor: 'test' stamp: 'JorgeRessia 4/13/2010 09:46'! testCreation | aPattern | aPattern := TLCaseInsensitiveWordPattern on: 'ab'. self assert: (aPattern matches: 'ab'). self assert: (aPattern matches: 'AB'). self assert: (aPattern matches: 'aB'). self assert: (aPattern matches: 'Ab').! ! TestCase subclass: #TLCaseRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLCaseRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/29/2010 22:33'! testCaseFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (aWord := TLWord with: (PPToken on: 'Case')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLCaseRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLCaseRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/29/2010 22:34'! testCaseFailureInSentence | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (aWord := TLWord with: (PPToken on: 'case')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLCaseRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLCaseRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/29/2010 22:34'! testCasesFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (aWord := TLWord with: (PPToken on: 'Cases')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLCaseRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLCaseRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/29/2010 22:34'! testCasesFailureInSentence | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (aWord := TLWord with: (PPToken on: 'cases')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLCaseRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLCaseRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/29/2010 22:33'! testFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'THE')). words add: (aWord := TLWord with: (PPToken on: 'CASE')). words add: (TLWord with: (PPToken on: 'IS')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLCaseRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLCaseRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/29/2010 22:33'! testSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLCaseRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! TestCase subclass: #TLCertainlyRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLCertainlyRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/29/2010 22:41'! testFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (aWord := TLWord with: (PPToken on: 'Certainly')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLCertainlyRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLCertainlyRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/29/2010 22:41'! testFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'THE')). words add: (aWord := TLWord with: (PPToken on: 'CERTAINLY')). words add: (TLWord with: (PPToken on: 'IS')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLCertainlyRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLCertainlyRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/29/2010 22:42'! testFailureInSentence | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (aWord := TLWord with: (PPToken on: 'certainly')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLCertainlyRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLCertainlyRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/29/2010 22:42'! testSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLCertainlyRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! TestCase subclass: #TLContinuousWordRepetitionRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLContinuousWordRepetitionRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 12:08'! testFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | aWord := TLWord with: (PPToken on: 'test'). anotherWord := TLWord with: (PPToken on: 'test'). words := OrderedCollection with: aWord with: anotherWord. aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLContinuousWordRepetitionRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLContinuousWordRepetitionRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 12:10'! testFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | aWord := TLWord with: (PPToken on: 'Test'). anotherWord := TLWord with: (PPToken on: 'test'). words := OrderedCollection with: aWord with: anotherWord. aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLContinuousWordRepetitionRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLContinuousWordRepetitionRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 12:10'! testFailureManyWords | aRule aDocument anotherWord aSentence words sentences aParagraph paragraphs results aWord | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'tes')). words add: (aWord := TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'xxxx')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLContinuousWordRepetitionRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLContinuousWordRepetitionRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 12:11'! testFailureThreeInRow | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (aWord := TLWord with: (PPToken on: 'test')). words add: (anotherWord := TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'xxxx')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLContinuousWordRepetitionRule new. results := aRule runOn: aDocument. self assert: results size = 2. self assert: results first element = aWord. self assert: results first rule = aRule. self assert: results second element = anotherWord. self assert: results second rule = aRule ! ! !TLContinuousWordRepetitionRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/12/2010 10:03'! testSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | aWord := TLWord with: (PPToken on: 'test1'). anotherWord := TLWord with: (PPToken on: 'test'). words := OrderedCollection with: aWord with: anotherWord. aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLContinuousWordRepetitionRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! !TLContinuousWordRepetitionRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/27/2010 13:43'! testSuccessWithNumbers | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | aWord := TLWord with: (PPToken on: '123'). anotherWord := TLWord with: (PPToken on: '123'). words := OrderedCollection with: aWord with: anotherWord. aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLContinuousWordRepetitionRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! TestCase subclass: #TLCouldRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLCouldRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/29/2010 14:45'! testFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (aWord := TLWord with: (PPToken on: 'Could')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLCouldRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLCouldRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/29/2010 14:44'! testFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'THE')). words add: (aWord := TLWord with: (PPToken on: 'COULD')). words add: (TLWord with: (PPToken on: 'IS')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLCouldRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLCouldRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/29/2010 14:45'! testFailureInSentence | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (aWord := TLWord with: (PPToken on: 'could')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLCouldRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLCouldRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/29/2010 14:44'! testSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLCouldRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! TestCase subclass: #TLCurrentlyRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLCurrentlyRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/29/2010 22:51'! testFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (aWord := TLWord with: (PPToken on: 'Currently')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLCurrentlyRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLCurrentlyRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/29/2010 22:51'! testFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'THE')). words add: (aWord := TLWord with: (PPToken on: 'CURRENTLY')). words add: (TLWord with: (PPToken on: 'IS')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLCurrentlyRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLCurrentlyRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/29/2010 22:52'! testFailureInSentence | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (aWord := TLWord with: (PPToken on: 'currently')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLCurrentlyRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLCurrentlyRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/29/2010 22:52'! testSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLCurrentlyRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! TestCase subclass: #TLDifferentThanRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLDifferentThanRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/29/2010 23:08'! testFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'Different')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'than')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLDifferentThanRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words size = 2. self assert: results first element words first = word1. self assert: results first element words last = word2. self assert: results first rule = aRule. ! ! !TLDifferentThanRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/29/2010 23:09'! testFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'DIFFERENT')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'THAN')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLDifferentThanRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words size = 2. self assert: results first element words first = word1. self assert: results first element words last = word2. self assert: results first rule = aRule. ! ! !TLDifferentThanRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/29/2010 23:09'! testFailureInSentence | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (word1 := TLWord with: (PPToken on: 'different')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'than')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLDifferentThanRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words size = 2. self assert: results first element words first = word1. self assert: results first element words last = word2. self assert: results first rule = aRule. ! ! !TLDifferentThanRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/29/2010 23:06'! testSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'than')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLDifferentThanRule new. results := aRule runOn: aDocument. self assert: results isEmpty. ! ! TestCase subclass: #TLDocumentTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Model'! !TLDocumentTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 09:25'! testAllElements | aDocument words aSentence aParagraph sentences paragraphs| words := OrderedCollection new. words add: (TLWord with: (PPToken on: '1')). words add: (TLWord with: (PPToken on: '2')). words add: (TLWord with: (PPToken on: '3')). words add: (TLWord with: (PPToken on: '4')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. self assert: aDocument allElements size = 7. self assert: (aDocument allElements includes: aDocument). self assert: (aDocument allElements includes: aParagraph). self assert: (aDocument allElements includes: aSentence). self assert: (aDocument allElements includes: words first). self assert: (aDocument allElements includes: words second). self assert: (aDocument allElements includes: words third). self assert: (aDocument allElements includes: words fourth).! ! !TLDocumentTest methodsFor: 'test' stamp: 'JorgeRessia 4/4/2010 13:38'! testCreation | aDocument | aDocument := TLDocument withAll: 1. self assert: aDocument paragraphs = 1! ! !TLDocumentTest methodsFor: 'test' stamp: 'JorgeRessia 4/9/2010 11:21'! testEmptyInterval | aDocument words aSentence aParagraph sentences paragraphs| words := OrderedCollection new. aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. self assert: aDocument interval size = 0! ! !TLDocumentTest methodsFor: 'test' stamp: 'JorgeRessia 4/9/2010 11:20'! testInterval | aDocument words aSentence aParagraph sentences paragraphs| words := OrderedCollection new. words add: (TLWord with: (PPToken on: '1' start: 1 stop: 1 )). words add: (TLWord with: (PPToken on: '2' start: 2 stop: 2 )). words add: (TLWord with: (PPToken on: '3' start: 3 stop: 3 )). words add: (TLWord with: (PPToken on: '4' start: 4 stop: 4 )). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. self assert: aDocument interval size = 4 ! ! !TLDocumentTest methodsFor: 'test' stamp: 'JorgeRessia 4/9/2010 14:04'! testIsDocument | aDocument | aDocument := TLDocument withAll: 1. self assert: aDocument isDocument. self deny: aDocument isParagraph. self deny: aDocument isSentence. self deny: aDocument isWord. self deny: aDocument isPunctuation. self deny: aDocument isEndOfDocument. self deny: aDocument isWhitespace. self deny: aDocument isPhrase.! ! !TLDocumentTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 11:56'! testSentences | aDocument words aSentence aParagraph sentences paragraphs| words := OrderedCollection new. words add: (TLWord with: (PPToken on: '1')). words add: (TLWord with: (PPToken on: '2')). words add: (TLWord with: (PPToken on: '3')). words add: (TLWord with: (PPToken on: '4')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. self assert: aDocument sentences size = 1. self assert: aDocument sentences first = aSentence! ! !TLDocumentTest methodsFor: 'test' stamp: 'JorgeRessia 4/9/2010 13:56'! testText | aDocument words aSentence aParagraph sentences paragraphs| words := OrderedCollection new. words add: (TLWord with: (PPToken on: '1')). words add: (TLWord with: (PPToken on: '2')). words add: (TLWord with: (PPToken on: '3')). words add: (TLWord with: (PPToken on: '4')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. self assert: aDocument text = '1234'! ! !TLDocumentTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 11:57'! testWords | aDocument words aSentence aParagraph sentences paragraphs| words := OrderedCollection new. words add: (TLWord with: (PPToken on: '1')). words add: (TLWord with: (PPToken on: '2')). words add: (TLWord with: (PPToken on: '3')). words add: (TLWord with: (PPToken on: '4')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. self assert: aDocument words size = 4. self assert: ( (aDocument words asArray at: 1) text = '1' ). self assert: ( (aDocument words asArray at: 2) text = '2' ). self assert: ( (aDocument words asArray at: 3) text = '3' ). self assert: ( (aDocument words asArray at: 4) text = '4' ).! ! TestCase subclass: #TLDoubtButRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLDoubtButRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/29/2010 22:19'! testFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'Doubt')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'but')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word3 := TLWord with: (PPToken on: 'to')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLDoubtButRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words size = 2. self assert: results first element words first= word1. self assert: results first element words second = word2. self assert: results first rule = aRule. ! ! !TLDoubtButRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/29/2010 22:18'! testFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'DOUBT')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'BUT')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word3 := TLWord with: (PPToken on: 'TO')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLDoubtButRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words size = 2. self assert: results first element words first= word1. self assert: results first element words second = word2. self assert: results first rule = aRule. ! ! !TLDoubtButRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/29/2010 22:19'! testFailureInSentence | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (word1 := TLWord with: (PPToken on: 'doubt')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'but')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word3 := TLWord with: (PPToken on: 'to')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLDoubtButRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words size = 2. self assert: results first element words first= word1. self assert: results first element words second = word2. self assert: results first rule = aRule. ! ! !TLDoubtButRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/29/2010 22:19'! testSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'but')). words add: (TLWord with: (PPToken on: 'order')). words add: (TLWord with: (PPToken on: 'to')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLDoubtButRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! TestCase subclass: #TLEachAndEveryOneRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLEachAndEveryOneRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/29/2010 23:19'! testFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 word4 | words := OrderedCollection new. word1 := words add: (TLWord with: (PPToken on: 'Each')). words add: (TLWhitespace with: (PPToken on: ' ')). word2 := words add: (TLWord with: (PPToken on: 'and')). words add: (TLWhitespace with: (PPToken on: ' ')). word3 := words add: (TLWord with: (PPToken on: 'every')). words add: (TLWhitespace with: (PPToken on: ' ')). word4 := words add: (TLWord with: (PPToken on: 'one')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLEachAndEveryOneRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first= word1. self assert: results first element words second = word2. self assert: results first element words third= word3. self assert: results first element words fourth = word4. self assert: results first rule = aRule. ! ! !TLEachAndEveryOneRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/29/2010 23:19'! testFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 word4 | words := OrderedCollection new. word1 := words add: (TLWord with: (PPToken on: 'EACH')). words add: (TLWhitespace with: (PPToken on: ' ')). word2 := words add: (TLWord with: (PPToken on: 'AND')). words add: (TLWhitespace with: (PPToken on: ' ')). word3 := words add: (TLWord with: (PPToken on: 'EVERY')). words add: (TLWhitespace with: (PPToken on: ' ')). word4 := words add: (TLWord with: (PPToken on: 'ONE')). words add: (TLWhitespace with: (PPToken on: ' ')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLEachAndEveryOneRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first= word1. self assert: results first element words second = word2. self assert: results first element words third= word3. self assert: results first element words fourth = word4. self assert: results first rule = aRule. ! ! !TLEachAndEveryOneRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/29/2010 23:19'! testFailureInSentence | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 word4 | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'A')). words add: (TLWhitespace with: (PPToken on: ' ')). word1 := words add: (TLWord with: (PPToken on: 'Each')). words add: (TLWhitespace with: (PPToken on: ' ')). word2 := words add: (TLWord with: (PPToken on: 'and')). words add: (TLWhitespace with: (PPToken on: ' ')). word3 := words add: (TLWord with: (PPToken on: 'every')). words add: (TLWhitespace with: (PPToken on: ' ')). word4 := words add: (TLWord with: (PPToken on: 'one')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLEachAndEveryOneRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first= word1. self assert: results first element words second = word2. self assert: results first element words third= word3. self assert: results first element words fourth = word4. self assert: results first rule = aRule. ! ! !TLEachAndEveryOneRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/29/2010 23:20'! testSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'A')). words add: (TLWord with: (PPToken on: 'every')). words add: (TLWord with: (PPToken on: 'one')). words add: (TLWord with: (PPToken on: 'most')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLEachAndEveryOneRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! TestCase subclass: #TLElementTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Model'! !TLElementTest methodsFor: 'test' stamp: 'JorgeRessia 4/9/2010 11:56'! testChildren | anElement | anElement := TLElement new. self assert: anElement children isEmpty! ! TestCase subclass: #TLEnormityRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLEnormityRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/29/2010 23:26'! testFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (aWord := TLWord with: (PPToken on: 'Enormity')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLEnormityRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLEnormityRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/29/2010 23:26'! testFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'THE')). words add: (aWord := TLWord with: (PPToken on: 'ENORMITY')). words add: (TLWord with: (PPToken on: 'IS')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLEnormityRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLEnormityRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/29/2010 23:26'! testFailureInSentence | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (aWord := TLWord with: (PPToken on: 'enormity')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLEnormityRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLEnormityRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/29/2010 23:26'! testSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLEnormityRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! TestCase subclass: #TLFactorRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLFactorRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/30/2010 23:10'! testFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (aWord := TLWord with: (PPToken on: 'Factor')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLFactorRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLFactorRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/30/2010 23:10'! testFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'THE')). words add: (aWord := TLWord with: (PPToken on: 'FACTOR')). words add: (TLWord with: (PPToken on: 'IS')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLFactorRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLFactorRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/30/2010 23:10'! testFailureInSentence | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (aWord := TLWord with: (PPToken on: 'factor')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLFactorRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLFactorRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/30/2010 23:11'! testSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLFactorRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! TestCase subclass: #TLFunnyRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLFunnyRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/30/2010 23:55'! testFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (aWord := TLWord with: (PPToken on: 'Funny')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLFunnyRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLFunnyRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/30/2010 23:56'! testFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'THE')). words add: (aWord := TLWord with: (PPToken on: 'FUNNY')). words add: (TLWord with: (PPToken on: 'IS')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLFunnyRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLFunnyRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/30/2010 23:56'! testFailureInSentence | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (aWord := TLWord with: (PPToken on: 'funny')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLFunnyRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLFunnyRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/30/2010 23:56'! testSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLFunnyRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! TestCase subclass: #TLHelpButRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLHelpButRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/29/2010 22:23'! testFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'Help')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'but')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word3 := TLWord with: (PPToken on: 'to')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLHelpButRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words size = 2. self assert: results first element words first= word1. self assert: results first element words second = word2. self assert: results first rule = aRule. ! ! !TLHelpButRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/29/2010 22:24'! testFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'HELP')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'BUT')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word3 := TLWord with: (PPToken on: 'TO')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLHelpButRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words size = 2. self assert: results first element words first= word1. self assert: results first element words second = word2. self assert: results first rule = aRule. ! ! !TLHelpButRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/29/2010 22:24'! testFailureInSentence | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (word1 := TLWord with: (PPToken on: 'help')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'but')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word3 := TLWord with: (PPToken on: 'to')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLHelpButRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words size = 2. self assert: results first element words first= word1. self assert: results first element words second = word2. self assert: results first rule = aRule. ! ! !TLHelpButRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/29/2010 22:24'! testSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'but')). words add: (TLWord with: (PPToken on: 'order')). words add: (TLWord with: (PPToken on: 'to')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLHelpButRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! TestCase subclass: #TLHelpToRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLHelpToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 11:48'! testHelpToFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'Help')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (TLWord with: (PPToken on: 'to')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLHelpToRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first text = 'Help'. self assert: results first element words last text = 'to'. self assert: results first rule = aRule. ! ! !TLHelpToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 11:49'! testHelpToFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'HELP')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (TLWord with: (PPToken on: 'TO')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLHelpToRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first text = 'HELP'. self assert: results first element words last text = 'TO'. self assert: results first rule = aRule. ! ! !TLHelpToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 11:49'! testHelpToFailureInSentence | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'Help')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (TLWord with: (PPToken on: 'to')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLHelpToRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first text = 'Help'. self assert: results first element words last text = 'to'. self assert: results first rule = aRule. ! ! !TLHelpToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 11:57'! testHelpToSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'help')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLHelpToRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! !TLHelpToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 11:50'! testHelpsToFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'Helps')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (TLWord with: (PPToken on: 'to')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLHelpToRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first text = 'Helps'. self assert: results first element words last text = 'to'. self assert: results first rule = aRule. ! ! !TLHelpToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 11:50'! testHelpsToFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'HELPS')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (TLWord with: (PPToken on: 'TO')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLHelpToRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first text = 'HELPS'. self assert: results first element words last text = 'TO'. self assert: results first rule = aRule. ! ! !TLHelpToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 11:50'! testHelpsToFailureInSentence | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'Helps')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (TLWord with: (PPToken on: 'to')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLHelpToRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first text = 'Helps'. self assert: results first element words last text = 'to'. self assert: results first rule = aRule. ! ! !TLHelpToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 11:58'! testHelpsToSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'helps')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLHelpToRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! TestCase subclass: #TLHoweverRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLHoweverRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 12:20'! testFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | aWord := TLWord with: (PPToken on: 'However'). anotherWord := TLWord with: (PPToken on: 'test'). words := OrderedCollection with: aWord with: anotherWord. aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLHoweverRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLHoweverRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 12:20'! testFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | aWord := TLWord with: (PPToken on: 'HowEvEr'). anotherWord := TLWord with: (PPToken on: 'test'). words := OrderedCollection with: aWord with: anotherWord. aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLHoweverRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLHoweverRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 11:58'! testSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | aWord := TLWord with: (PPToken on: 'test'). anotherWord := TLWord with: (PPToken on: 'test'). words := OrderedCollection with: aWord with: anotherWord. aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLHoweverRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! TestCase subclass: #TLImportantlyRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLImportantlyRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/30/2010 23:17'! testFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (aWord := TLWord with: (PPToken on: 'Importantly')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLImportantlyRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLImportantlyRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/30/2010 23:18'! testFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'THE')). words add: (aWord := TLWord with: (PPToken on: 'IMPORTANTLY')). words add: (TLWord with: (PPToken on: 'IS')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLImportantlyRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLImportantlyRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/30/2010 23:18'! testFailureInSentence | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (aWord := TLWord with: (PPToken on: 'importantly')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLImportantlyRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLImportantlyRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/30/2010 23:18'! testSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLImportantlyRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! TestCase subclass: #TLInOrdeToRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLInOrdeToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 11:57'! testFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'In')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'order')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word3 := TLWord with: (PPToken on: 'to')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLInOrderToRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first= word1. self assert: results first element words second = word2. self assert: results first element words last = word3. self assert: results first rule = aRule. ! ! !TLInOrdeToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 11:57'! testFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'IN')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'ORDER')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word3 := TLWord with: (PPToken on: 'TO')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLInOrderToRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first= word1. self assert: results first element words second = word2. self assert: results first element words last = word3. self assert: results first rule = aRule. ! ! !TLInOrdeToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 11:57'! testFailureInSentence | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (word1 := TLWord with: (PPToken on: 'In')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'order')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word3 := TLWord with: (PPToken on: 'to')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLInOrderToRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first= word1. self assert: results first element words second = word2. self assert: results first element words last = word3. self assert: results first rule = aRule. ! ! !TLInOrdeToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/13/2010 19:57'! testSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'order')). words add: (TLWord with: (PPToken on: 'to')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLInOrderToRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! TestCase subclass: #TLInRegardsToRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLInRegardsToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/30/2010 23:26'! testFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'In')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'regards')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word3 := TLWord with: (PPToken on: 'to')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLInRegardsToRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first= word1. self assert: results first element words second = word2. self assert: results first element words last = word3. self assert: results first rule = aRule. ! ! !TLInRegardsToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/30/2010 23:26'! testFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'IN')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'REGARDS')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word3 := TLWord with: (PPToken on: 'TO')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLInRegardsToRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first= word1. self assert: results first element words second = word2. self assert: results first element words last = word3. self assert: results first rule = aRule. ! ! !TLInRegardsToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/30/2010 23:26'! testFailureInSentence | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (word1 := TLWord with: (PPToken on: 'In')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'regards')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word3 := TLWord with: (PPToken on: 'to')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLInRegardsToRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first= word1. self assert: results first element words second = word2. self assert: results first element words last = word3. self assert: results first rule = aRule. ! ! !TLInRegardsToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/30/2010 23:26'! testSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'order')). words add: (TLWord with: (PPToken on: 'to')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLInRegardsToRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! TestCase subclass: #TLInTermsOfRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLInTermsOfRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/30/2010 23:37'! testFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'In')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'terms')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word3 := TLWord with: (PPToken on: 'of')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLInTermsOfRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first= word1. self assert: results first element words second = word2. self assert: results first element words last = word3. self assert: results first rule = aRule. ! ! !TLInTermsOfRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/30/2010 23:38'! testFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'IN')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'TERMS')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word3 := TLWord with: (PPToken on: 'OF')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLInTermsOfRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first= word1. self assert: results first element words second = word2. self assert: results first element words last = word3. self assert: results first rule = aRule. ! ! !TLInTermsOfRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/30/2010 23:38'! testFailureInSentence | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (word1 := TLWord with: (PPToken on: 'In')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'terms')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word3 := TLWord with: (PPToken on: 'of')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLInTermsOfRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first= word1. self assert: results first element words second = word2. self assert: results first element words last = word3. self assert: results first rule = aRule. ! ! !TLInTermsOfRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/30/2010 23:38'! testSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'order')). words add: (TLWord with: (PPToken on: 'to')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLInTermsOfRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! TestCase subclass: #TLIndexedElementTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLIndexedElementTest methodsFor: 'test' stamp: 'JorgeRessia 4/12/2010 20:23'! testCreation | anIndexedElement | anIndexedElement := TLIndexedElement of: 1. self assert: anIndexedElement element = 1! ! !TLIndexedElementTest methodsFor: 'test' stamp: 'JorgeRessia 4/12/2010 20:53'! testNext | anIndexedElement elements element1 element2 element3 aPhrase | elements := OrderedCollection new. elements add: ( element1 := TLWord with: (PPToken on: 'allow')). elements add: ( element2 :=TLWhitespace with: (PPToken on: ' ')). elements add: ( element3 :=TLWord with: (PPToken on: 'to')). aPhrase := TLPhrase withAll: elements. anIndexedElement := TLIndexedElement of: aPhrase. self assert: anIndexedElement current = element1. self assert: anIndexedElement next = element2. self assert: anIndexedElement next = element3. self assert: anIndexedElement next = nil! ! TestCase subclass: #TLInsightfulRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLInsightfulRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/30/2010 23:46'! testFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (aWord := TLWord with: (PPToken on: 'Insightful')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLInsightfulRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLInsightfulRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/30/2010 23:46'! testFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'THE')). words add: (aWord := TLWord with: (PPToken on: 'INSIGHTFUL')). words add: (TLWord with: (PPToken on: 'IS')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLInsightfulRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLInsightfulRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/30/2010 23:47'! testFailureInSentence | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (aWord := TLWord with: (PPToken on: 'insightful')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLInsightfulRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLInsightfulRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/30/2010 23:47'! testSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLInsightfulRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! TestCase subclass: #TLInterestingRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLInterestingRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/30/2010 23:53'! testFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (aWord := TLWord with: (PPToken on: 'Interesting')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLInterestingRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLInterestingRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/30/2010 23:53'! testFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'THE')). words add: (aWord := TLWord with: (PPToken on: 'INTERESTING')). words add: (TLWord with: (PPToken on: 'IS')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLInterestingRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLInterestingRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/30/2010 23:53'! testFailureInSentence | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (aWord := TLWord with: (PPToken on: 'interesting')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLInterestingRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLInterestingRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/30/2010 23:53'! testSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLInterestingRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! TestCase subclass: #TLIrregardlesRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLIrregardlesRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/31/2010 00:00'! testFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (aWord := TLWord with: (PPToken on: 'Irregardless')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLIrregardlessRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLIrregardlesRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/31/2010 00:00'! testFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'THE')). words add: (aWord := TLWord with: (PPToken on: 'IRREGARDLESS')). words add: (TLWord with: (PPToken on: 'IS')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLIrregardlessRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLIrregardlesRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/31/2010 00:00'! testFailureInSentence | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (aWord := TLWord with: (PPToken on: 'irregardless')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLIrregardlessRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLIrregardlesRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/31/2010 00:00'! testSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLIrregardlessRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! TestCase subclass: #TLJoinedSentencesWithCommasRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLJoinedSentencesWithCommasRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/27/2010 12:08'! testFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'The')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'truth')). words add: (word1 := TLWord with: (PPToken on: 'The')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'truth')). words add: (word1 := TLWord with: (PPToken on: 'The')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'truth')). words add: (TLPunctuationMark with: (PPToken on: ',')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word1 := TLWord with: (PPToken on: 'The')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'truth')). words add: (word1 := TLWord with: (PPToken on: 'The')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'truth')). words add: (word3 := TLWord with: (PPToken on: 'is')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLJoinedSentencesWithCommasRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element = aSentence. self assert: results first rule = aRule. ! ! !TLJoinedSentencesWithCommasRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 16:24'! testSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLJoinedSentencesWithCommasRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! !TLJoinedSentencesWithCommasRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/27/2010 17:06'! testSuccessAnd | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLPunctuationMark with: (PPToken on: ',')). words add: (TLWord with: (PPToken on: 'and')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLJoinedSentencesWithCommasRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! !TLJoinedSentencesWithCommasRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/27/2010 17:09'! testSuccessAs | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLPunctuationMark with: (PPToken on: ',')). words add: (TLWord with: (PPToken on: 'as')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLJoinedSentencesWithCommasRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! !TLJoinedSentencesWithCommasRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/27/2010 17:08'! testSuccessBeacause | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLPunctuationMark with: (PPToken on: ',')). words add: (TLWord with: (PPToken on: 'because')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLJoinedSentencesWithCommasRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! !TLJoinedSentencesWithCommasRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/27/2010 17:07'! testSuccessBut | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLPunctuationMark with: (PPToken on: ',')). words add: (TLWord with: (PPToken on: 'but')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLJoinedSentencesWithCommasRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! !TLJoinedSentencesWithCommasRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/27/2010 17:07'! testSuccessHowever | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLPunctuationMark with: (PPToken on: ',')). words add: (TLWord with: (PPToken on: 'however')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLJoinedSentencesWithCommasRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! !TLJoinedSentencesWithCommasRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/27/2010 12:08'! testSuccessNotEnoughWordAfterComma | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'The')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'truth')). words add: (TLPunctuationMark with: (PPToken on: ',')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word1 := TLWord with: (PPToken on: 'The')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'truth')). words add: (word1 := TLWord with: (PPToken on: 'The')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'truth')). words add: (word3 := TLWord with: (PPToken on: 'is')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLJoinedSentencesWithCommasRule new. results := aRule runOn: aDocument. self assert: results isEmpty ! ! !TLJoinedSentencesWithCommasRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/27/2010 12:07'! testSuccessNotEnoughWordBeforeComma | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'The')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'truth')). words add: (word1 := TLWord with: (PPToken on: 'The')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'truth')). words add: (word1 := TLWord with: (PPToken on: 'The')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'truth')). words add: (TLPunctuationMark with: (PPToken on: ',')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word3 := TLWord with: (PPToken on: 'is')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLJoinedSentencesWithCommasRule new. results := aRule runOn: aDocument. self assert: results isEmpty ! ! !TLJoinedSentencesWithCommasRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/27/2010 17:07'! testSuccessSince | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLPunctuationMark with: (PPToken on: ',')). words add: (TLWord with: (PPToken on: 'since')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLJoinedSentencesWithCommasRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! !TLJoinedSentencesWithCommasRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/27/2010 17:08'! testSuccessStill | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLPunctuationMark with: (PPToken on: ',')). words add: (TLWord with: (PPToken on: 'still')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLJoinedSentencesWithCommasRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! !TLJoinedSentencesWithCommasRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/27/2010 17:08'! testSuccessThough | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLPunctuationMark with: (PPToken on: ',')). words add: (TLWord with: (PPToken on: 'though')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLJoinedSentencesWithCommasRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! !TLJoinedSentencesWithCommasRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 16:27'! testSuccessWithComma | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 | words := OrderedCollection new. words add: (word2 := TLWord with: (PPToken on: 'truth')). words add: (TLPunctuationMark with: (PPToken on: ',')). words add: (TLWhitespace with: (PPToken on: ' ')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLJoinedSentencesWithCommasRule new. results := aRule runOn: aDocument. self assert: results isEmpty. ! ! !TLJoinedSentencesWithCommasRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/27/2010 17:08'! testSuccessYet | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLPunctuationMark with: (PPToken on: ',')). words add: (TLWord with: (PPToken on: 'yet')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLJoinedSentencesWithCommasRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! TestCase subclass: #TLLongParagraphRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLLongParagraphRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/28/2010 11:23'! testFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'that')). words add: (TLWhitespace with: (PPToken on: ' ')). aSentence := TLSentence withAll: words. sentences := OrderedCollection new. 11 timesRepeat: [ sentences add: aSentence ]. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLLongParagraphRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element = aParagraph. self assert: results first rule = aRule. ! ! !TLLongParagraphRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/28/2010 11:23'! testSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. 25 timesRepeat: [ words add: ( TLWord with: (PPToken on: 'order')) ]. words add: (TLWord with: (PPToken on: 'that')). words add: (TLWhitespace with: (PPToken on: ' ')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLLongParagraphRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! TestCase subclass: #TLLongSentenceRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLLongSentenceRuleTest methodsFor: 'test' stamp: 'lr 5/28/2010 11:56'! testFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 | aRule := TLLongSentenceRule new. words := OrderedCollection new. aRule maxWordsPerSentence timesRepeat: [ words add: ( TLWord with: (PPToken on: 'order')) ]. words add: (TLWord with: (PPToken on: 'that')). words add: (TLWhitespace with: (PPToken on: ' ')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element = aSentence. self assert: results first rule = aRule. ! ! !TLLongSentenceRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/28/2010 10:43'! testSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. 25 timesRepeat: [ words add: ( TLWord with: (PPToken on: 'order')) ]. words add: (TLWord with: (PPToken on: 'that')). words add: (TLWhitespace with: (PPToken on: ' ')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLLongSentenceRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! TestCase subclass: #TLNoCommaBeforeThatRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLNoCommaBeforeThatRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 15:42'! testFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'order')). words add: (TLPunctuationMark with: (PPToken on: ',')). words add: (word2 := TLWord with: (PPToken on: 'that')). words add: (TLWhitespace with: (PPToken on: ' ')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLNoCommaBeforeThatRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first= word1. self assert: results first element words second = word2. self assert: results first rule = aRule. ! ! !TLNoCommaBeforeThatRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 15:49'! testFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'ORDER')). words add: (TLPunctuationMark with: (PPToken on: ',')). words add: (word2 := TLWord with: (PPToken on: 'THAT')). words add: (TLWhitespace with: (PPToken on: ' ')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLNoCommaBeforeThatRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first= word1. self assert: results first element words second = word2. self assert: results first rule = aRule. ! ! !TLNoCommaBeforeThatRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 15:50'! testFailureInSentence | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (word1 := TLWord with: (PPToken on: 'order')). words add: (TLPunctuationMark with: (PPToken on: ',')). words add: (word2 := TLWord with: (PPToken on: 'that')). words add: (TLWhitespace with: (PPToken on: ' ')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLNoCommaBeforeThatRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first= word1. self assert: results first element words second = word2. self assert: results first rule = aRule. ! ! !TLNoCommaBeforeThatRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 15:21'! testSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'order')). words add: (TLWord with: (PPToken on: 'to')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLNoCommaBeforeThatRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! TestCase subclass: #TLNoContinuousPunctuationMarksRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLNoContinuousPunctuationMarksRuleTest methodsFor: 'test' stamp: 'JorgeRessia 6/10/2010 16:02'! testFailureWithComma | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 | words := OrderedCollection new. words add: ( TLWord with: (PPToken on: 'order')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word1 := TLPunctuationMark with: (PPToken on: ',')). words add: (word2 := TLPunctuationMark with: (PPToken on: ',')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWhitespace with: (PPToken on: ' ')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLNoContinuousPunctuationMarksRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element children first = word1. self assert: results first element children last = word2. self assert: results first rule = aRule. ! ! !TLNoContinuousPunctuationMarksRuleTest methodsFor: 'test' stamp: 'JorgeRessia 6/10/2010 16:02'! testFailureWithExcalmation | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 | words := OrderedCollection new. words add: ( TLWord with: (PPToken on: 'order')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word1 := TLPunctuationMark with: (PPToken on: '!!')). words add: (word2 := TLPunctuationMark with: (PPToken on: '!!')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWhitespace with: (PPToken on: ' ')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLNoContinuousPunctuationMarksRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element children first = word1. self assert: results first element children last = word2. self assert: results first rule = aRule. ! ! !TLNoContinuousPunctuationMarksRuleTest methodsFor: 'test' stamp: 'JorgeRessia 6/10/2010 16:02'! testFailureWithMixed | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 | words := OrderedCollection new. words add: ( TLWord with: (PPToken on: 'order')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word1 := TLPunctuationMark with: (PPToken on: ',')). words add: (word2 := TLPunctuationMark with: (PPToken on: '.')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWhitespace with: (PPToken on: ' ')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLNoContinuousPunctuationMarksRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element children first = word1. self assert: results first element children last = word2. self assert: results first rule = aRule. ! ! !TLNoContinuousPunctuationMarksRuleTest methodsFor: 'test' stamp: 'JorgeRessia 6/10/2010 16:02'! testFailureWithMixedPeriod | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 | words := OrderedCollection new. words add: ( TLWord with: (PPToken on: 'order')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word1 := TLPunctuationMark with: (PPToken on: '!!')). words add: (word2 := TLPunctuationMark with: (PPToken on: '.')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWhitespace with: (PPToken on: ' ')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLNoContinuousPunctuationMarksRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element children first = word1. self assert: results first element children last = word2. self assert: results first rule = aRule. ! ! !TLNoContinuousPunctuationMarksRuleTest methodsFor: 'test' stamp: 'JorgeRessia 6/10/2010 16:02'! testFailureWithPeriod | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 | words := OrderedCollection new. words add: ( TLWord with: (PPToken on: 'order')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word1 := TLPunctuationMark with: (PPToken on: '.')). words add: (word2 := TLPunctuationMark with: (PPToken on: '.')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWhitespace with: (PPToken on: ' ')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLNoContinuousPunctuationMarksRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element children first = word1. self assert: results first element children last = word2. self assert: results first rule = aRule. ! ! !TLNoContinuousPunctuationMarksRuleTest methodsFor: 'test' stamp: 'JorgeRessia 6/10/2010 16:03'! testFailureWithQuestion | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 | words := OrderedCollection new. words add: ( TLWord with: (PPToken on: 'order')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word1 := TLPunctuationMark with: (PPToken on: '?')). words add: (word2 := TLPunctuationMark with: (PPToken on: '?')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWhitespace with: (PPToken on: ' ')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLNoContinuousPunctuationMarksRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element children first = word1. self assert: results first element children last = word2. self assert: results first rule = aRule. ! ! !TLNoContinuousPunctuationMarksRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/28/2010 11:11'! testSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLPunctuationMark with: (PPToken on: ',')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'order')). words add: (TLWord with: (PPToken on: 'to')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLNoContinuousPunctuationMarksRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! !TLNoContinuousPunctuationMarksRuleTest methodsFor: 'test' stamp: 'JorgeRessia 6/10/2010 16:03'! testSuccessWithPunctuationMarks | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLPunctuationMark with: (PPToken on: ',')). words add: (TLPunctuationMark with: (PPToken on: '"')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'order')). words add: (TLWord with: (PPToken on: 'to')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLNoContinuousPunctuationMarksRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! TestCase subclass: #TLNoContractionsRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLNoContractionsRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/30/2010 20:35'! testFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'I')). words add: (TLPunctuationMark with: (PPToken on: '''')). words add: (word2 := TLWord with: (PPToken on: 'LL')). words add: (TLWhitespace with: (PPToken on: ' ')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLNoContractionsRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first= word1. self assert: results first element words second = word2. self assert: results first rule = aRule. ! ! !TLNoContractionsRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/30/2010 20:33'! testFailureLL | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'I')). words add: (TLPunctuationMark with: (PPToken on: '''')). words add: (word2 := TLWord with: (PPToken on: 'll')). words add: (TLWhitespace with: (PPToken on: ' ')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLNoContractionsRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first= word1. self assert: results first element words second = word2. self assert: results first rule = aRule. ! ! !TLNoContractionsRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/30/2010 20:33'! testFailureT | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'don')). words add: (TLPunctuationMark with: (PPToken on: '''')). words add: (word2 := TLWord with: (PPToken on: 't')). words add: (TLWhitespace with: (PPToken on: ' ')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLNoContractionsRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first= word1. self assert: results first element words second = word2. self assert: results first rule = aRule. ! ! !TLNoContractionsRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/30/2010 20:32'! testFailureVE | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'I')). words add: (TLPunctuationMark with: (PPToken on: '''')). words add: (word2 := TLWord with: (PPToken on: 've')). words add: (TLWhitespace with: (PPToken on: ' ')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLNoContractionsRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first= word1. self assert: results first element words second = word2. self assert: results first rule = aRule. ! ! !TLNoContractionsRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/30/2010 20:34'! testSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'order')). words add: (TLWord with: (PPToken on: 'to')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLNoContractionsRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! !TLNoContractionsRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/30/2010 20:34'! testSuccessS | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'he')). words add: (TLPunctuationMark with: (PPToken on: '''')). words add: (word2 := TLWord with: (PPToken on: 's')). words add: (TLWhitespace with: (PPToken on: ' ')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLNoContractionsRule new. results := aRule runOn: aDocument. self assert: results isEmpty ! ! TestCase subclass: #TLNoSpacesBeforePunctuationMarkRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLNoSpacesBeforePunctuationMarkRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/28/2010 11:03'! testFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 | words := OrderedCollection new. words add: ( TLWord with: (PPToken on: 'order')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLPunctuationMark with: (PPToken on: ',')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWhitespace with: (PPToken on: ' ')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLNoSpacesBeforePunctuationMarkRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element = word2. self assert: results first rule = aRule. ! ! !TLNoSpacesBeforePunctuationMarkRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/28/2010 10:15'! testSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLPunctuationMark with: (PPToken on: ',')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'order')). words add: (TLWord with: (PPToken on: 'to')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLNoSpacesBeforePunctuationMarkRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! TestCase subclass: #TLOneOfTheMostRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLOneOfTheMostRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 13:16'! testFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 word4 | words := OrderedCollection new. word1 := words add: (TLWord with: (PPToken on: 'One')). words add: (TLWhitespace with: (PPToken on: ' ')). word2 := words add: (TLWord with: (PPToken on: 'of')). words add: (TLWhitespace with: (PPToken on: ' ')). word3 := words add: (TLWord with: (PPToken on: 'the')). words add: (TLWhitespace with: (PPToken on: ' ')). word4 := words add: (TLWord with: (PPToken on: 'most')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLOneOfTheMostRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first= word1. self assert: results first element words second = word2. self assert: results first element words third= word3. self assert: results first element words fourth = word4. self assert: results first rule = aRule. ! ! !TLOneOfTheMostRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 13:18'! testFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 word4 | words := OrderedCollection new. word1 := words add: (TLWord with: (PPToken on: 'ONE')). words add: (TLWhitespace with: (PPToken on: ' ')). word2 := words add: (TLWord with: (PPToken on: 'OF')). words add: (TLWhitespace with: (PPToken on: ' ')). word3 := words add: (TLWord with: (PPToken on: 'THE')). words add: (TLWhitespace with: (PPToken on: ' ')). word4 := words add: (TLWord with: (PPToken on: 'MOST')). words add: (TLWhitespace with: (PPToken on: ' ')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLOneOfTheMostRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first= word1. self assert: results first element words second = word2. self assert: results first element words third= word3. self assert: results first element words fourth = word4. self assert: results first rule = aRule. ! ! !TLOneOfTheMostRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 13:18'! testFailureInSentence | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 word4 | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'A')). words add: (TLWhitespace with: (PPToken on: ' ')). word1 := words add: (TLWord with: (PPToken on: 'One')). words add: (TLWhitespace with: (PPToken on: ' ')). word2 := words add: (TLWord with: (PPToken on: 'of')). words add: (TLWhitespace with: (PPToken on: ' ')). word3 := words add: (TLWord with: (PPToken on: 'the')). words add: (TLWhitespace with: (PPToken on: ' ')). word4 := words add: (TLWord with: (PPToken on: 'most')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLOneOfTheMostRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first= word1. self assert: results first element words second = word2. self assert: results first element words third= word3. self assert: results first element words fourth = word4. self assert: results first rule = aRule. ! ! !TLOneOfTheMostRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 11:58'! testSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'A')). words add: (TLWord with: (PPToken on: 'of')). words add: (TLWord with: (PPToken on: 'the')). words add: (TLWord with: (PPToken on: 'most')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLOneOfTheMostRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! TestCase subclass: #TLParagraphTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Model'! !TLParagraphTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 12:06'! testCreation | aParagraph | aParagraph := TLParagraph withAll: (OrderedCollection with: (TLWord with: 2)). self assert: aParagraph sentences size = 1. self assert: aParagraph sentences first text = 2! ! !TLParagraphTest methodsFor: 'test' stamp: 'JorgeRessia 4/9/2010 11:38'! testEmptyInterval | aParagraph words aSentence anotherSentence sentences | words := OrderedCollection new. words add: (TLWord with: (PPToken on: '1' start: 1stop: 1 )). words add: (TLWord with: (PPToken on: '2' start: 2stop: 2 )). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence with: (TLWhitespace with: (PPToken on: ' ' start: 3 stop: 3 )). aParagraph := TLParagraph withAll: sentences. self assert: aParagraph interval size = 3! ! !TLParagraphTest methodsFor: 'test' stamp: 'JorgeRessia 4/9/2010 11:37'! testInterval | aParagraph words aSentence sentences | words := OrderedCollection new. aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. self assert: aParagraph interval size = 0! ! !TLParagraphTest methodsFor: 'test' stamp: 'JorgeRessia 4/9/2010 14:05'! testIsParagraph | aParagraph | aParagraph := TLParagraph withAll: 1. self assert: aParagraph isParagraph. self deny: aParagraph isDocument. self deny: aParagraph isSentence. self deny: aParagraph isWord. self deny: aParagraph isPunctuation. self deny: aParagraph isEndOfDocument. self deny: aParagraph isWhitespace. self deny: aParagraph isPhrase.! ! !TLParagraphTest methodsFor: 'test' stamp: 'JorgeRessia 4/9/2010 11:34'! testSentences | aParagraph words aSentence anotherSentence sentences | aParagraph := TLParagraph withAll: (OrderedCollection with: (TLWord with: '2')). self assert: aParagraph sentences size = 1. self assert: aParagraph sentences first text = '2'. words := OrderedCollection new. words add: (TLWord with: (PPToken on: '1')). words add: (TLWord with: (PPToken on: '2')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence with: (TLWhitespace with: (PPToken on: ' ')). aParagraph := TLParagraph withAll: sentences. self assert: aParagraph sentences size = 1. self assert: aParagraph sentences first text = '12'.! ! !TLParagraphTest methodsFor: 'test' stamp: 'JorgeRessia 4/9/2010 13:57'! testText | aParagraph words aSentence anotherSentence sentences | words := OrderedCollection new. words add: (TLWord with: (PPToken on: '1')). words add: (TLWord with: (PPToken on: '2')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence with: (TLWhitespace with: (PPToken on: ' ')). aParagraph := TLParagraph withAll: sentences. self assert: aParagraph text = '12 '! ! !TLParagraphTest methodsFor: 'test' stamp: 'JorgeRessia 4/12/2010 10:52'! testWords | aParagraph words aSentence anotherSentence sentences | words := OrderedCollection new. words add: (TLWord with: (PPToken on: '2')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. self assert: aParagraph words size = 1. self assert: aParagraph words first text = '2'. words := OrderedCollection new. words add: (TLWord with: (PPToken on: '1')). words add: (TLWord with: (PPToken on: '2')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence with: (TLWhitespace with: (PPToken on: ' ')). aParagraph := TLParagraph withAll: sentences. self assert: aParagraph words size = 2. self assert: aParagraph words first text = '1'. self assert: aParagraph words last text = '2'.! ! TestCase subclass: #TLPhraseTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Model'! !TLPhraseTest methodsFor: 'test' stamp: 'JorgeRessia 4/8/2010 14:59'! testCreation | aPhrase | aPhrase := TLPhrase withAll: 1. self assert: aPhrase children = 1! ! !TLPhraseTest methodsFor: 'test' stamp: 'JorgeRessia 4/9/2010 11:44'! testEmptyInterval | aPhrase words| words := OrderedCollection new. aPhrase := TLPhrase withAll: words. self assert: aPhrase interval size = 0! ! !TLPhraseTest methodsFor: 'test' stamp: 'JorgeRessia 4/9/2010 11:44'! testInterval | aPhrase words| words := OrderedCollection new. words add: (TLWord with: (PPToken on: '1' start: 1 stop: 1 )). words add: (TLWhitespace with: (PPToken on: ' ' start: 2 stop: 2 )). words add: (TLWord with: (PPToken on: '2' start: 3 stop: 3 )). aPhrase := TLPhrase withAll: words. self assert: aPhrase interval size = 3! ! !TLPhraseTest methodsFor: 'test' stamp: 'JorgeRessia 4/9/2010 14:04'! testIsPhrase | aParagraph | aParagraph := TLPhrase withAll: 1. self assert: aParagraph isPhrase. self deny: aParagraph isDocument. self deny: aParagraph isSentence. self deny: aParagraph isWord. self deny: aParagraph isPunctuation. self deny: aParagraph isEndOfDocument. self deny: aParagraph isWhitespace. self deny: aParagraph isParagraph.! ! !TLPhraseTest methodsFor: 'test' stamp: 'JorgeRessia 9/3/2010 11:27'! testPhraseWithoutMarkups | aPhrase tokens| tokens := OrderedCollection new. tokens add: (TLWord with: (PPToken on: '1')). tokens add: (TLWord with: (PPToken on: '2')). tokens add: (TLWhitespace with: (PPToken on: ' ')). tokens add: (TLMarkup with: (PPToken on: '\emph ')). aPhrase := TLPhrase withAll: tokens. self assert: aPhrase phraseWithoutMarkups isPhrase. self assert: aPhrase phraseWithoutMarkups children size = 3. self assert: aPhrase phraseWithoutMarkups children first text = '1'. self assert: aPhrase phraseWithoutMarkups children second text = '2'. self assert: aPhrase phraseWithoutMarkups children last isWhitespace.! ! !TLPhraseTest methodsFor: 'test' stamp: 'JorgeRessia 4/8/2010 15:02'! testText | aPhrase words| words := OrderedCollection new. words add: (TLWord with: (PPToken on: '1')). words add: (TLWord with: (PPToken on: '2')). aPhrase := TLPhrase withAll: words. self assert: aPhrase text = '12'! ! !TLPhraseTest methodsFor: 'test' stamp: 'JorgeRessia 4/8/2010 15:15'! testTextWithSyntacticElements | aPhrase words| words := OrderedCollection new. words add: (TLWord with: (PPToken on: '1')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (TLWord with: (PPToken on: '2')). aPhrase := TLPhrase withAll: words. self assert: aPhrase text = '1 2'! ! !TLPhraseTest methodsFor: 'test' stamp: 'JorgeRessia 4/8/2010 15:00'! testWords | aPhrase tokens| tokens := OrderedCollection new. tokens add: (TLWord with: (PPToken on: '1')). tokens add: (TLWord with: (PPToken on: '2')). tokens add: (TLWhitespace with: (PPToken on: ' ')). aPhrase := TLPhrase withAll: tokens. self assert: aPhrase words size = 2. self assert: aPhrase words first text = '1'. self assert: aPhrase words last text = '2'.! ! TestCase subclass: #TLPunctuationMarkTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Model'! !TLPunctuationMarkTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 13:52'! testCreation | aToken | aToken := TLPunctuationMark with: 1. self assert: aToken text = 1! ! !TLPunctuationMarkTest methodsFor: 'test' stamp: 'JorgeRessia 4/9/2010 11:52'! testInterval | aToken | aToken := TLPunctuationMark with: (PPToken on: '.' start: 1 stop: 1) . self assert: aToken interval size = 1! ! !TLPunctuationMarkTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 14:17'! testIsEndOfSentence | aToken | aToken := TLPunctuationMark with: (PPToken on: '.'). self assert: aToken isEndOfSentence. aToken := TLPunctuationMark with: (PPToken on: ';'). self assert: aToken isEndOfSentence. aToken := TLPunctuationMark with: (PPToken on: ':'). self assert: aToken isEndOfSentence. aToken := TLPunctuationMark with: (PPToken on: '!!'). self assert: aToken isEndOfSentence. aToken := TLPunctuationMark with: (PPToken on: '?'). self assert: aToken isEndOfSentence. aToken := TLPunctuationMark with: (PPToken on: ','). self deny: aToken isEndOfSentence.! ! !TLPunctuationMarkTest methodsFor: 'test' stamp: 'JorgeRessia 4/9/2010 14:05'! testIsPunctuation | aToken | aToken := TLPunctuationMark with: 1. self assert: aToken isPunctuation. self deny: aToken isParagraph. self deny: aToken isDocument. self deny: aToken isSentence. self deny: aToken isWord. self deny: aToken isEndOfDocument. self deny: aToken isWhitespace. self deny: aToken isPhrase.! ! !TLPunctuationMarkTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 13:54'! testText | aToken | aToken := TLPunctuationMark with: (PPToken on: '1') . self assert: aToken text = '1'! ! TestCase subclass: #TLRegardedAsBeingRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLRegardedAsBeingRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 11:57'! testFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'Regarded')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'as')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word3 := TLWord with: (PPToken on: 'being')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLRegardedAsBeingRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first= word1. self assert: results first element words second = word2. self assert: results first element words last = word3. self assert: results first rule = aRule. ! ! !TLRegardedAsBeingRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 11:58'! testFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'REGARDED')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'AS')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word3 := TLWord with: (PPToken on: 'being')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLRegardedAsBeingRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first= word1. self assert: results first element words second = word2. self assert: results first element words last = word3. self assert: results first rule = aRule. ! ! !TLRegardedAsBeingRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 11:58'! testFailureInSentence | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (word1 := TLWord with: (PPToken on: 'Regarded')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'as')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word3 := TLWord with: (PPToken on: 'being')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLRegardedAsBeingRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first= word1. self assert: results first element words second = word2. self assert: results first element words last = word3. self assert: results first rule = aRule. ! ! !TLRegardedAsBeingRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 11:59'! testSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'as')). words add: (TLWord with: (PPToken on: 'being')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLRegardedAsBeingRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! TestCase subclass: #TLRequireToRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLRequireToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 11:53'! testRequireToFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'Require')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'to')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLRequireToRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first= word1. self assert: results first element words second = word2. self assert: results first rule = aRule. ! ! !TLRequireToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 11:53'! testRequireToFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'REQUIRE')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'TO')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLRequireToRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first= word1. self assert: results first element words second = word2. self assert: results first rule = aRule.! ! !TLRequireToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 11:53'! testRequireToFailureInSentence | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (word1 := TLWord with: (PPToken on: 'Require')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'to')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLRequireToRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first= word1. self assert: results first element words second = word2. self assert: results first rule = aRule. ! ! !TLRequireToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 11:59'! testRequireToSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'require')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLRequireToRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! !TLRequireToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 11:53'! testRequiresToFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'Requires')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'to')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLRequireToRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first= word1. self assert: results first element words second = word2. self assert: results first rule = aRule. ! ! !TLRequireToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 11:53'! testRequiresToFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'REQUIRES')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'TO')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLRequireToRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first= word1. self assert: results first element words second = word2. self assert: results first rule = aRule. ! ! !TLRequireToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 11:54'! testRequiresToFailureInSentence | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (word1 := TLWord with: (PPToken on: 'Requires')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'to')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLRequireToRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words first= word1. self assert: results first element words second = word2. self assert: results first rule = aRule. ! ! !TLRequireToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 11:59'! testRequiresToSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'resquires')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLRequireToRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! TestCase subclass: #TLRuleFailureTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Runner'! !TLRuleFailureTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 22:37'! testCreation | aFailure | aFailure := TLRuleFailure on: 1 at: 2. self assert: aFailure rule = 1. self assert: aFailure element = 2! ! TestCase subclass: #TLRulePatternTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLRulePatternTest methodsFor: 'test' stamp: 'JorgeRessia 4/12/2010 21:31'! testCreation | aRulePattern aWord anotherWord elements aPhrase | aRulePattern := TLRulePattern new. aWord := TLWord with: (PPToken on: 'Allow'). anotherWord := TLWord with: (PPToken on: 'Allows'). aRulePattern anyOf: (OrderedCollection with: aWord with: aWord). aRulePattern anyNumberOf: (TLWhitespace with: (PPToken on: ' ')). aRulePattern with: (TLWord with: (PPToken on: 'to')). elements := OrderedCollection new. elements add: (TLWord with: (PPToken on: 'Allow')). elements add: (TLWhitespace with: (PPToken on: ' ')). elements add: (TLWord with: (PPToken on: 'to')). aPhrase := TLPhrase withAll: elements. self assert: (aRulePattern matches: aPhrase)! ! !TLRulePatternTest methodsFor: 'test' stamp: 'JorgeRessia 4/12/2010 21:36'! testCreationAnother | aRulePattern aWord anotherWord elements aPhrase | aRulePattern := TLRulePattern new. aWord := TLWord with: (PPToken on: 'Allow'). anotherWord := TLWord with: (PPToken on: 'Allows'). aRulePattern anyOf: (OrderedCollection with: aWord with: anotherWord). aRulePattern anyNumberOf: (TLWhitespace with: (PPToken on: ' ')). aRulePattern with: (TLWord with: (PPToken on: 'to')). elements := OrderedCollection new. elements add: (TLWord with: (PPToken on: 'Allow')). elements add: (TLWhitespace with: (PPToken on: ' ')). elements add: (TLWord with: (PPToken on: 'to')). aPhrase := TLPhrase withAll: elements. self assert: (aRulePattern matches: aPhrase). elements := OrderedCollection new. elements add: (TLWord with: (PPToken on: 'Allows')). elements add: (TLWhitespace with: (PPToken on: ' ')). elements add: (TLWord with: (PPToken on: 'to')). aPhrase := TLPhrase withAll: elements. self assert: (aRulePattern matches: aPhrase)! ! TestCase subclass: #TLRulesArchitectureTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLRulesArchitectureTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 22:34'! testName TLTextLintRule allSubclassesDo: [ :aClass | aClass new name size > 10 ]. ! ! !TLRulesArchitectureTest methodsFor: 'test' stamp: 'JorgeRessia 4/2/2010 17:54'! testRationale TLTextLintRule allSubclassesDo: [ :aClass | aClass new rationale size > 10]. ! ! TestCase subclass: #TLSentenceTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Model'! !TLSentenceTest class methodsFor: 'accessing' stamp: 'lr 4/8/2010 13:33'! packageNamesUnderTest ^ #('TextLint-Model')! ! !TLSentenceTest methodsFor: 'test' stamp: 'JorgeRessia 4/9/2010 13:59'! testAllPhrasesOfSize | aSentence words phrases | words := OrderedCollection new. words add: (TLWord with: (PPToken on: '1')). words add: (TLWord with: (PPToken on: '2')). words add: (TLWord with: (PPToken on: '3')). words add: (TLWord with: (PPToken on: '4')). words add: (TLWord with: (PPToken on: '5')). aSentence := TLSentence withAll: words. phrases := aSentence allPhrasesOfSize: 3. self assert: phrases size = 3. self assert: phrases first text = '123'. self assert: phrases second text = '234'. self assert: phrases last text = '345'.! ! !TLSentenceTest methodsFor: 'test' stamp: 'JorgeRessia 4/9/2010 13:59'! testAllPhrasesOfSizeOne | aSentence words phrases aWord | words := OrderedCollection new. words add: (aWord := TLWord with: (PPToken on: '1')). aSentence := TLSentence withAll: words. phrases := aSentence allPhrasesOfSize: 1. self assert: phrases size = 1. self assert: phrases first words size = 1. self assert: phrases first words first = aWord.! ! !TLSentenceTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 11:59'! testContainsPhraseAtTheBeginning | aSentence words| words := OrderedCollection new. words add: (TLWord with: (PPToken on: '1')). words add: (TLWord with: (PPToken on: '2')). words add: (TLWord with: (PPToken on: '3')). words add: (TLWord with: (PPToken on: 'xxxx')). aSentence := TLSentence withAll: words. self assert: (aSentence containsPhrase: '1 2 3')! ! !TLSentenceTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 11:59'! testContainsPhraseAtTheEnd | aSentence words| words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'xxxx')). words add: (TLWord with: (PPToken on: '1')). words add: (TLWord with: (PPToken on: '2')). words add: (TLWord with: (PPToken on: '3')). aSentence := TLSentence withAll: words. self assert: (aSentence containsPhrase: '1 2 3')! ! !TLSentenceTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 11:59'! testContainsPhraseAtTheMiddle | aSentence words| words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'xxxx')). words add: (TLWord with: (PPToken on: '1')). words add: (TLWord with: (PPToken on: '2')). words add: (TLWord with: (PPToken on: '3')). words add: (TLWord with: (PPToken on: 'xxxx')). aSentence := TLSentence withAll: words. self assert: (aSentence containsPhrase: '1 2 3')! ! !TLSentenceTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 11:59'! testContainsPhraseInAnyCase | aSentence words| words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'xxxx')). words add: (TLWord with: (PPToken on: 'a')). words add: (TLWord with: (PPToken on: 'b')). words add: (TLWord with: (PPToken on: 'c')). aSentence := TLSentence withAll: words. self assert: (aSentence containsPhrase: 'A B C'). words add: (TLWord with: (PPToken on: 'xxxx')). words add: (TLWord with: (PPToken on: 'a')). words add: (TLWord with: (PPToken on: 'b')). words add: (TLWord with: (PPToken on: 'c')). aSentence := TLSentence withAll: words. self assert: (aSentence containsPhrase: 'a b c'). words add: (TLWord with: (PPToken on: 'xxxx')). words add: (TLWord with: (PPToken on: 'a')). words add: (TLWord with: (PPToken on: 'B')). words add: (TLWord with: (PPToken on: 'c')). aSentence := TLSentence withAll: words. self assert: (aSentence containsPhrase: 'A B c')! ! !TLSentenceTest methodsFor: 'test' stamp: 'JorgeRessia 4/8/2010 10:49'! testCreation | aSentence | aSentence := TLSentence withAll: 1. self assert: aSentence children = 1! ! !TLSentenceTest methodsFor: 'test' stamp: 'JorgeRessia 4/9/2010 11:48'! testEmptyInterval | aSentence words| words := OrderedCollection new. aSentence := TLSentence withAll: words. self assert: aSentence interval size = 0! ! !TLSentenceTest methodsFor: 'test' stamp: 'JorgeRessia 4/9/2010 11:47'! testInterval | aSentence words| words := OrderedCollection new. words add: (TLWord with: (PPToken on: '1' start: 1 stop: 1)). words add: (TLWord with: (PPToken on: '2' start: 2 stop: 2)). words add: (TLWhitespace with: (PPToken on: ' ' start: 3 stop: 3)). aSentence := TLSentence withAll: words. self assert: aSentence interval size = 3! ! !TLSentenceTest methodsFor: 'test' stamp: 'JorgeRessia 4/9/2010 14:05'! testIsSentence | aSentence | aSentence := TLSentence withAll: 1. self assert: aSentence isSentence. self deny: aSentence isParagraph. self deny: aSentence isDocument. self deny: aSentence isWord. self deny: aSentence isPunctuation. self deny: aSentence isEndOfDocument. self deny: aSentence isWhitespace. self deny: aSentence isPhrase.! ! !TLSentenceTest methodsFor: 'test' stamp: 'JorgeRessia 4/9/2010 13:54'! testText | aSentence tokens| tokens := OrderedCollection new. tokens add: (TLWord with: (PPToken on: '1')). tokens add: (TLWord with: (PPToken on: '2')). tokens add: (TLWhitespace with: (PPToken on: ' ')). aSentence := TLSentence withAll: tokens. self assert: aSentence text = '12 '! ! !TLSentenceTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 15:31'! testWords | aSentence tokens| tokens := OrderedCollection new. tokens add: (TLWord with: (PPToken on: '1')). tokens add: (TLWord with: (PPToken on: '2')). tokens add: (TLWhitespace with: (PPToken on: ' ')). aSentence := TLSentence withAll: tokens. self assert: aSentence words size = 2. self assert: aSentence words first text = '1'. self assert: aSentence words last text = '2'.! ! !TLSentenceTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 11:59'! testWordsAsString | aSentence words| words := OrderedCollection new. words add: (TLWord with: (PPToken on: '1')). words add: (TLWord with: (PPToken on: '2')). aSentence := TLSentence withAll: words. self assert: aSentence wordsAsString = ' 1 2'! ! !TLSentenceTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 11:59'! testWordsAsStringRealText | aSentence words| words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'a')). words add: (TLWord with: (PPToken on: 'lot')). words add: (TLWord with: (PPToken on: 'that')). aSentence := TLSentence withAll: words. self assert: aSentence wordsAsString = ' test a lot that'! ! TestCase subclass: #TLSingleOcurrencyPatternTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLSingleOcurrencyPatternTest methodsFor: 'test' stamp: 'lr 5/30/2010 20:13'! testConsumeFrom | aPattern aWord anotherWord elements aPhrase aWhitespace anIndexedElement | elements := OrderedCollection new. elements add: (TLWord with: (PPToken on: 'allow')). elements add: (aWhitespace := TLWhitespace with: (PPToken on: ' ')). elements add: (TLWord with: (PPToken on: 'to')). aPhrase := TLPhrase withAll: elements. anIndexedElement := TLIndexedElement of: aPhrase. aPattern := TLSingleOccurrencePattern of: (TLWord with: (PPToken on: 'allow')). self assert: (aPattern consumeFrom: anIndexedElement ). self assert: anIndexedElement current = aWhitespace ! ! !TLSingleOcurrencyPatternTest methodsFor: 'test' stamp: 'lr 5/30/2010 20:13'! testCreation | aPattern aWord anotherWord elements aPhrase | aPattern := TLSingleOccurrencePattern of: 1. self assert: (aPattern instVarNamed: 'element' ) = 1. ! ! TestCase subclass: #TLSomehowRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLSomehowRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 15:37'! testFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (aWord := TLWord with: (PPToken on: 'Somehow')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLSomehowRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLSomehowRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 15:37'! testFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'THE')). words add: (aWord := TLWord with: (PPToken on: 'SOMEHOW')). words add: (TLWord with: (PPToken on: 'IS')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLSomehowRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLSomehowRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 15:38'! testFailureInSentence | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (aWord := TLWord with: (PPToken on: 'Somehow')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLSomehowRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLSomehowRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/12/2010 15:35'! testSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLSomehowRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! TestCase subclass: #TLStuffRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLStuffRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 15:38'! testFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'THE')). words add: (aWord := TLWord with: (PPToken on: 'STUFF')). words add: (TLWord with: (PPToken on: 'IS')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLStuffRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLStuffRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 15:38'! testStuffFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (aWord := TLWord with: (PPToken on: 'Stuff')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLStuffRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLStuffRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 15:38'! testStuffFailureInSentence | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (aWord := TLWord with: (PPToken on: 'stuff')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLStuffRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLStuffRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 15:38'! testStuffsFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (aWord := TLWord with: (PPToken on: 'Stuffs')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLStuffRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLStuffRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 15:38'! testStuffsFailureInSentence | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (aWord := TLWord with: (PPToken on: 'stuffs')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLStuffRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element = aWord. self assert: results first rule = aRule ! ! !TLStuffRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/8/2010 14:20'! testSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'truth')). words add: (TLWord with: (PPToken on: 'is')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLStuffRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! TestCase subclass: #TLTerminatorMarkTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Model'! !TLTerminatorMarkTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 14:19'! testCreation | aToken | aToken := TLTerminatorMark with: 1. self assert: aToken text = 1! ! !TLTerminatorMarkTest methodsFor: 'test' stamp: 'JorgeRessia 4/9/2010 11:53'! testInterval | aToken | aToken := TLTerminatorMark with: (PPToken on: '.' start: 1 stop: 1) . self assert: aToken interval size = 1! ! !TLTerminatorMarkTest methodsFor: 'test' stamp: 'JorgeRessia 4/9/2010 14:05'! testIsEndOfDocument | aToken | aToken := TLTerminatorMark with: 1. self assert: aToken isEndOfDocument. self deny: aToken isParagraph. self deny: aToken isDocument. self deny: aToken isSentence. self deny: aToken isWord. self deny: aToken isPunctuation. self deny: aToken isWhitespace. self deny: aToken isPhrase.! ! !TLTerminatorMarkTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 14:20'! testText | aToken | aToken := TLTerminatorMark with: (PPToken on: '1') . self assert: aToken text = '1'! ! TestCase subclass: #TLTextLintCheckerTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Runner'! !TLTextLintCheckerTest methodsFor: 'test' stamp: 'JorgeRessia 4/9/2010 15:38'! testCheckSingleRule | aChecker results| aChecker := TLTextLintChecker new. aChecker addRule: (TLALotRule new). results := aChecker check: 'test a lot that.'. self assert: ( results size = 1 ). self assert: results first element isPhrase. self assert: ( results first element text = 'a lot' ). ! ! TestCase subclass: #TLTextParserTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Parser'! !TLTextParserTest methodsFor: 'utilities' stamp: 'lr 5/27/2010 16:35'! parse: aString ^ self parse: aString tokenizer: TLTextTokenizer! ! !TLTextParserTest methodsFor: 'utilities' stamp: 'lr 5/27/2010 16:34'! parse: aString tokenizer: aClass | document | document := TLTextPhraser parse: (aClass parse: aString) onError: [ :err | self error: err printString ]. self assert: document text = aString description: 'Parse invariant not satisfied'. self assert: (document printString includesSubString: aString) description: 'Document print string should include its contents'. self assert: (aString copyFrom: document start to: document stop) = aString description: 'Invalid start/stop of document'. document paragraphs do: [ :each | self assert: (aString copyFrom: each start to: each stop) = each text description: 'Invalid start/stop of paragraph' ]. document sentences do: [ :each | self assert: (aString copyFrom: each start to: each stop) = each text description: 'Invalid start/stop of sentence' ]. document words do: [ :each | self assert: (aString copyFrom: each start to: each stop) = each text description: 'Invalid start/stop of word' ]. ^ document! ! !TLTextParserTest methodsFor: 'test' stamp: 'lr 4/8/2010 13:52'! testAllCharacters | document | document := self parse: (String withAll: Character allByteCharacters). self assert: document paragraphs size = 3. self assert: document sentences size = 8. self assert: document words size = 9! ! !TLTextParserTest methodsFor: 'test' stamp: 'lr 4/8/2010 13:46'! testDeformedParagraphs | document | document := self parse: 'text1 text2'. self assert: document paragraphs size = 2. self assert: document sentences size = 2. self assert: document words size = 2. self assert: document words first text = 'text1'. self assert: document words second text = 'text2'! ! !TLTextParserTest methodsFor: 'test' stamp: 'lr 5/27/2010 16:38'! testHtmlTokenziation | document | document := self parse: '