SystemOrganization addCategory: #'TextLint-Tests-Model'! SystemOrganization addCategory: #'TextLint-Tests-Parser'! SystemOrganization addCategory: #'TextLint-Tests-Runner'! SystemOrganization addCategory: #'TextLint-Tests-Rules'! SystemOrganization addCategory: #'TextLint-Tests-Dictionary'! 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 9/24/2010 15:18'! testFailureMarkup | 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: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: #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: #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: #TLCaseRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLCaseRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/1/2010 14:58'! 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 isRuleFailure. self assert: results first element isPhrase. self assert: results first element words size = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule. ! ! !TLCaseRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/1/2010 14:58'! 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. 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 = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule. ! ! !TLCaseRuleTest methodsFor: 'test' stamp: 'lr 11/30/2010 19:30'! testCaseFailureWithCaseStudy | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (aWord := TLWord with: (PPToken on: 'case')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (TLWord with: (PPToken on: 'study')). 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! ! !TLCaseRuleTest methodsFor: 'test' stamp: 'lr 11/30/2010 19:31'! testCaseFailureWithCaseStudyAndSeparator | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (aWord := TLWord with: (PPToken on: 'case')). words add: (TLPunctuationMark with: (PPToken on: '-')). words add: (TLWord with: (PPToken on: 'study')). 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! ! !TLCaseRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/1/2010 14:58'! 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. 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 = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule. ! ! !TLCaseRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/1/2010 14:58'! 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. 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 = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule. ! ! !TLCaseRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/1/2010 14:59'! 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 isRuleFailure. self assert: results first element isPhrase. self assert: results first element words size = 1. self assert: results first element words first= 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 11/1/2010 14:26'! 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 isRuleFailure. self assert: results first element isPhrase. self assert: results first element words size = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule. ! ! !TLCertainlyRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/1/2010 14:27'! 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. 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 = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule. ! ! !TLCertainlyRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/1/2010 14:27'! 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. 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 = 1. self assert: results first element words first= 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: #TLConnectorRepetitionInParagraphRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLConnectorRepetitionInParagraphRuleTest methodsFor: 'test' stamp: 'JorgeRessia 9/29/2010 09:55'! testFailureFurthermore | words word1 word2 aSentence sentences aParagraph paragraphs aDocument aRule results | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'furthermore')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (TLWord with: (PPToken on: 'lot')). words add: (word2 := TLWord with: (PPToken on: 'furthermore')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLConnectorRepetitionInParagraphRule new. results := aRule runOn: aDocument. self assert: results size = 2. self assert: results first element = word1. self assert: results second element = word2. ! ! !TLConnectorRepetitionInParagraphRuleTest methodsFor: 'test' stamp: 'JorgeRessia 9/29/2010 10:20'! testFailureHowever | words word1 word2 aSentence sentences aParagraph paragraphs aDocument aRule results | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'however')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (TLWord with: (PPToken on: 'lot')). words add: (word2 := TLWord with: (PPToken on: 'however')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLConnectorRepetitionInParagraphRule new. results := aRule runOn: aDocument. self assert: results size = 2. self assert: results first element = word1. self assert: results second element = word2. ! ! !TLConnectorRepetitionInParagraphRuleTest methodsFor: 'test' stamp: 'JorgeRessia 9/29/2010 09:53'! testFailureInAddition | words word1 word2 aSentence sentences aParagraph paragraphs aDocument aRule results word3 word4 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'in')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'addition')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word3 := TLWord with: (PPToken on: 'in')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word4 := TLWord with: (PPToken on: 'addition')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLConnectorRepetitionInParagraphRule new. results := aRule runOn: aDocument. self assert: results size = 2. 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 second element isPhrase. self assert: results second element words first = word3. self assert: results second element words second = word4. ! ! !TLConnectorRepetitionInParagraphRuleTest methodsFor: 'test' stamp: 'JorgeRessia 9/29/2010 10:21'! testFailureInContrastTo | words word1 word2 aSentence sentences aParagraph paragraphs aDocument aRule results word3 word4 word5 word6 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'in')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'contrast')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word3 := TLWord with: (PPToken on: 'to')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word4 := TLWord with: (PPToken on: 'in')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word5 := TLWord with: (PPToken on: 'contrast')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word6 := TLWord with: (PPToken on: 'to')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLConnectorRepetitionInParagraphRule new. results := aRule runOn: aDocument. self assert: results size = 2. 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 second element isPhrase. self assert: results second element words first = word4. self assert: results second element words second = word5. self assert: results second element words third = word6. ! ! !TLConnectorRepetitionInParagraphRuleTest methodsFor: 'test' stamp: 'JorgeRessia 9/29/2010 10:22'! testFailureNevertheless | words word1 word2 aSentence sentences aParagraph paragraphs aDocument aRule results | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'nevertheless')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (TLWord with: (PPToken on: 'lot')). words add: (word2 := TLWord with: (PPToken on: 'nevertheless')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLConnectorRepetitionInParagraphRule new. results := aRule runOn: aDocument. self assert: results size = 2. self assert: results first element = word1. self assert: results second element = word2. ! ! !TLConnectorRepetitionInParagraphRuleTest methodsFor: 'test' stamp: 'JorgeRessia 9/29/2010 10:23'! testFailureOnTheOtherHand | words word1 word2 aSentence sentences aParagraph paragraphs aDocument aRule results word3 word4 word5 word6 word7 word8 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'on')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'the')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word3 := TLWord with: (PPToken on: 'other')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word4 := TLWord with: (PPToken on: 'hand')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word5 := TLWord with: (PPToken on: 'on')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word6 := TLWord with: (PPToken on: 'the')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word7 := TLWord with: (PPToken on: 'other')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word8 := TLWord with: (PPToken on: 'hand')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLConnectorRepetitionInParagraphRule new. results := aRule runOn: aDocument. self assert: results size = 2. 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 second element isPhrase. self assert: results second element words first = word5. self assert: results second element words second = word6. self assert: results second element words third = word7. self assert: results second element words fourth = word8. ! ! !TLConnectorRepetitionInParagraphRuleTest methodsFor: 'test' stamp: 'JorgeRessia 9/29/2010 10:23'! testFailureStill | words word1 word2 aSentence sentences aParagraph paragraphs aDocument aRule results | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'still')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (TLWord with: (PPToken on: 'lot')). words add: (word2 := TLWord with: (PPToken on: 'still')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLConnectorRepetitionInParagraphRule new. results := aRule runOn: aDocument. self assert: results size = 2. self assert: results first element = word1. self assert: results second element = word2. ! ! !TLConnectorRepetitionInParagraphRuleTest methodsFor: 'test' stamp: 'JorgeRessia 9/29/2010 10:23'! testFailureTwoParagraph | aRule aWord aDocument anotherWord aSentence words sentences aParagraph anotherParagraph paragraphs results word1 word2 word3 word4 word5 word6 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'however')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (TLWord with: (PPToken on: 'lot')). words add: (word2 := TLWord with: (PPToken on: 'however')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. words := OrderedCollection new. words add: (word4 := TLWord with: (PPToken on: 'however')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (TLWord with: (PPToken on: 'lot')). words add: (word5 := TLWord with: (PPToken on: 'however')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. anotherParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph with: anotherParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLConnectorRepetitionInParagraphRule new. results := aRule runOn: aDocument. self assert: results size = 4. self assert: results first element = word1. self assert: results second element = word2. self assert: results third element = word4. self assert: results fourth element = word5. ! ! !TLConnectorRepetitionInParagraphRuleTest methodsFor: 'test' stamp: 'JorgeRessia 9/23/2010 21:29'! 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: 'lot')). 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 := TLConnectorRepetitionInParagraphRule new. results := aRule runOn: aDocument. self assert: results isEmpty. ! ! !TLConnectorRepetitionInParagraphRuleTest methodsFor: 'test' stamp: 'JorgeRessia 9/23/2010 21:34'! testSuccessDueToInvalidWord | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'test')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (TLWord with: (PPToken on: 'lot')). words add: (word2 := 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 := TLConnectorRepetitionInParagraphRule new. results := aRule runOn: aDocument. self assert: results isEmpty. ! ! !TLConnectorRepetitionInParagraphRuleTest methodsFor: 'test' stamp: 'JorgeRessia 9/23/2010 21:29'! testSuccessInTwoParagraphs | aRule aWord aDocument anotherWord aSentence words sentences aParagraph anotherParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (TLWord with: (PPToken on: 'lot')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test1')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (TLWord with: (PPToken on: 'lot')). words add: (TLWord with: (PPToken on: 'test1')). words add: (TLWord with: (PPToken on: 'test1')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. anotherParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph with: anotherParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLConnectorRepetitionInParagraphRule new. results := aRule runOn: aDocument. self assert: results isEmpty. ! ! TestCase subclass: #TLContinuousWordRepetitionRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLContinuousWordRepetitionRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/1/2010 15:36'! 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 isRuleFailure. self assert: results first element isPhrase. self assert: results first element words size = 2. self assert: results first element words first = aWord. self assert: results first element words second = anotherWord. self assert: results first rule = aRule. ! ! !TLContinuousWordRepetitionRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/1/2010 15:36'! 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 isRuleFailure. self assert: results first element isPhrase. self assert: results first element words size = 2. self assert: results first element words first = aWord. self assert: results first element words second = anotherWord. self assert: results first rule = aRule. ! ! !TLContinuousWordRepetitionRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/1/2010 15:47'! 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: (anotherWord := 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 isRuleFailure. self assert: results first element isPhrase. self assert: results first element words size = 2. self assert: results first element words first = aWord. self assert: results first element words second = anotherWord. self assert: results first rule = aRule. ! ! !TLContinuousWordRepetitionRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/1/2010 15:49'! testFailureThreeInRow | aRule aDocument aSentence words sentences aParagraph paragraphs results word1 word2 word3| words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'test')). words add: (word2 := TLWord with: (PPToken on: 'test')). words add: (word3 := 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 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. self assert: results second isRuleFailure. self assert: results second element isPhrase. self assert: results second element words size = 2. self assert: results second element words first = word2. self assert: results second element words second = word3. 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 11/1/2010 14:28'! 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 isRuleFailure. self assert: results first element isPhrase. self assert: results first element words size = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule. ! ! !TLCouldRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/1/2010 14:28'! 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. 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 = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule. ! ! !TLCouldRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/1/2010 14:28'! 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. 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 = 1. self assert: results first element words first= 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 11/1/2010 14:28'! 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 isRuleFailure. self assert: results first element isPhrase. self assert: results first element words size = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule. ! ! !TLCurrentlyRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/1/2010 14:28'! 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. 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 = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule. ! ! !TLCurrentlyRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/1/2010 14:28'! 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. 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 = 1. self assert: results first element words first= 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: #TLDictionaryParserTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Dictionary'! !TLDictionaryParserTest methodsFor: 'utilities' stamp: 'JorgeRessia 4/27/2011 12:42'! parse: aString | type | type := TLDictionaryParser parse: aString onError: [ :err | self error: err printString ]. "self assert: type = 'Noun' description: 'Parse invariant not satisfied'." ^ type ! ! !TLDictionaryParserTest methodsFor: 'test' stamp: 'JorgeRessia 4/27/2011 14:51'! testNoun | dictionary | "type := self parse: 'aardvark orycte/rope[Noun]'." dictionary := self parse: 'aardvark[Noun]'. self assert: dictionary wordDefinitions size = 1. self assert: ( dictionary wordDefinitions first word = 'aardvark' ). self assert: ( dictionary wordDefinitions first type isNoun ). ! ! !TLDictionaryParserTest methodsFor: 'test' stamp: 'JorgeRessia 4/27/2011 14:51'! testVerb | dictionary | "type := self parse: 'aardvark orycte/rope[Noun]'." dictionary := self parse: 'aardvark[Verb]'. self assert: dictionary wordDefinitions size = 1. self assert: ( dictionary wordDefinitions first word = 'aardvark' ). self assert: ( dictionary wordDefinitions first type isVerb ). ! ! 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 11/1/2010 14:28'! 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 isRuleFailure. self assert: results first element isPhrase. self assert: results first element words size = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule. ! ! !TLEnormityRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/1/2010 14:28'! 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. 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 = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule. ! ! !TLEnormityRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/1/2010 14:28'! 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. 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 = 1. self assert: results first element words first= 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 11/1/2010 14:29'! 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 isRuleFailure. self assert: results first element isPhrase. self assert: results first element words size = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule. ! ! !TLFactorRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/1/2010 14:29'! 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. 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 = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule. ! ! !TLFactorRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/1/2010 14:29'! 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. 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 = 1. self assert: results first element words first= 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 11/1/2010 14:26'! testFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (aWord := TLWord with: (PPToken on: 'Funny')). words add: (TLWhitespace with: (PPToken on: ' ')). 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 isRuleFailure. self assert: results first element isPhrase. self assert: results first element words size = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule.! ! !TLFunnyRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/1/2010 11:30'! 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. 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 = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule. ! ! !TLFunnyRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/1/2010 11:30'! 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. 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 = 1. self assert: results first element words first= 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: 'lr 11/2/2010 12:28'! 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 isPhrase. self assert: results first element size = 1. self assert: results first element children first = aWord. self assert: results first rule = aRule! ! !TLHoweverRuleTest methodsFor: 'test' stamp: 'lr 11/2/2010 12:28'! 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 isPhrase. self assert: results first element size = 1. self assert: results first element children first = 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 11/1/2010 14:29'! 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 isRuleFailure. self assert: results first element isPhrase. self assert: results first element words size = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule. ! ! !TLImportantlyRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/1/2010 14:29'! 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. 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 = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule. ! ! !TLImportantlyRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/1/2010 14:29'! 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. 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 = 1. self assert: results first element words first= 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: #TLInsightfulRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLInsightfulRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/1/2010 14:29'! 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 isRuleFailure. self assert: results first element isPhrase. self assert: results first element words size = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule. ! ! !TLInsightfulRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/1/2010 14:29'! 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. 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 = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule. ! ! !TLInsightfulRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/1/2010 14:29'! 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. 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 = 1. self assert: results first element words first= 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 11/1/2010 14:29'! 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 isRuleFailure. self assert: results first element isPhrase. self assert: results first element words size = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule. ! ! !TLInterestingRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/1/2010 14:29'! 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. 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 = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule. ! ! !TLInterestingRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/1/2010 14:30'! 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. 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 = 1. self assert: results first element words first= 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 11/1/2010 14:30'! 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 isRuleFailure. self assert: results first element isPhrase. self assert: results first element words size = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule. ! ! !TLIrregardlesRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/1/2010 14:30'! 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. 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 = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule. ! ! !TLIrregardlesRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/1/2010 14:30'! 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. 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 = 1. self assert: results first element words first= 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: #TLLetsRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLLetsRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/26/2011 13:48'! testFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (aWord := TLWord with: (PPToken on: 'Lets')). 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 := TLLetsRule 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 = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule. ! ! !TLLetsRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/26/2011 13:48'! 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: 'LETS')). 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 := TLLetsRule new. results := aRule runOn: aDocument. 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 = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule. ! ! !TLLetsRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/26/2011 13:48'! 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: 'lets')). 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 := TLLetsRule new. results := aRule runOn: aDocument. 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 = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule. ! ! !TLLetsRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/26/2011 13:48'! 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: 'let')). 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 := TLLetsRule 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 4/26/2011 13:49'! 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: 'r')). 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 11/2/2010 09:05'! testColonFailure | aRule aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. words add: ( TLWord with: (PPToken on: 'order')). words add: (word1 := 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 isPhrase. self assert: results first element children size = 2. self assert: results first element children first= word1. self assert: results first element children second= word2. self assert: results first rule = aRule. ! ! !TLNoSpacesBeforePunctuationMarkRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/2/2010 09:01'! testCommaFailure | aRule aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. words add: ( TLWord with: (PPToken on: 'order')). words add: (word1 := 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 isPhrase. self assert: results first element children size = 2. self assert: results first element children first= word1. self assert: results first element children second= word2. self assert: results first rule = aRule. ! ! !TLNoSpacesBeforePunctuationMarkRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/2/2010 08:59'! testDoubleSpaceFailure | aRule aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. words add: ( TLWord with: (PPToken on: 'order')). words add: ( TLWhitespace with: (PPToken on: ' ')). words add: (word1 := 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 isPhrase. self assert: results first element children size = 2. self assert: results first element children first= word1. self assert: results first element children second= word2. self assert: results first rule = aRule. ! ! !TLNoSpacesBeforePunctuationMarkRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/2/2010 09:04'! testExclamationFailure | aRule aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. words add: ( TLWord with: (PPToken on: 'order')). words add: (word1 := 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 isPhrase. self assert: results first element children size = 2. self assert: results first element children first= word1. self assert: results first element children second= word2. self assert: results first rule = aRule. ! ! !TLNoSpacesBeforePunctuationMarkRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/1/2010 16:04'! testFailure | aRule aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. words add: ( TLWord with: (PPToken on: 'order')). words add: (word1 := 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 isPhrase. self assert: results first element children size = 2. self assert: results first element children first= word1. self assert: results first element children second= word2. self assert: results first rule = aRule. ! ! !TLNoSpacesBeforePunctuationMarkRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/2/2010 09:00'! testPeriodFailure | aRule aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. words add: ( TLWord with: (PPToken on: 'order')). words add: (word1 := 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 isPhrase. self assert: results first element children size = 2. self assert: results first element children first= word1. self assert: results first element children second= word2. self assert: results first rule = aRule. ! ! !TLNoSpacesBeforePunctuationMarkRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/2/2010 09:01'! testQuestionFailure | aRule aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. words add: ( TLWord with: (PPToken on: 'order')). words add: (word1 := 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 isPhrase. self assert: results first element children size = 2. self assert: results first element children first= word1. self assert: results first element children second= word2. self assert: results first rule = aRule. ! ! !TLNoSpacesBeforePunctuationMarkRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/2/2010 09:05'! testSemicolonFailure | aRule aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. words add: ( TLWord with: (PPToken on: 'order')). words add: (word1 := 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 isPhrase. self assert: results first element children size = 2. self assert: results first element children first= word1. self assert: results first element children second= 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! ! !TLNoSpacesBeforePunctuationMarkRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/2/2010 09:00'! testSuccessWithOtherPunctuation | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWhitespace 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 := TLNoSpacesBeforePunctuationMarkRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! TestCase subclass: #TLOftenEnoughRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLOftenEnoughRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/3/2010 12:10'! testFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'Often')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'enough')). words add: (TLWhitespace with: (PPToken on: ' ')). 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 := TLOftenEnoughRule 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. ! ! !TLOftenEnoughRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/3/2010 12:10'! testFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'OFTEN')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'ENOUGH')). words add: (TLWhitespace with: (PPToken on: ' ')). 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 := TLOftenEnoughRule 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. ! ! !TLOftenEnoughRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/3/2010 12:10'! 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: 'often')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'enough')). words add: (TLWhitespace with: (PPToken on: ' ')). 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 := TLOftenEnoughRule 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. ! ! !TLOftenEnoughRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/3/2010 12:10'! 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: 'often')). words add: (TLWord with: (PPToken on: 'order')). words add: (TLWord with: (PPToken on: 'enough')). 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 := TLOftenEnoughRule 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: #TLPhrasePatternRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLPhrasePatternRuleTest methodsFor: 'as yet unclassified' stamp: 'JorgeRessia 11/4/2010 09:53'! testCommaWhitespaceBetweenWords | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'So')). words add: (TLPunctuationMark with: (PPToken on: ',')). words add: (TLWhitespace new). words add: (word2 := TLWord with: (PPToken on: 'Called')). words add: (TLWhitespace with: (PPToken on: ' ')). 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 := TLPhrasePatternRule named: 'Avoid "So,Called"' rationale: 'rationale' matching: 'so, called'. 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. ! ! !TLPhrasePatternRuleTest methodsFor: 'as yet unclassified' stamp: 'JorgeRessia 11/4/2010 09:54'! testCommaWhitespaceBetweenWordsFail | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'So')). words add: (TLWhitespace new). words add: (TLPunctuationMark with: (PPToken on: ',')). words add: (word2 := TLWord with: (PPToken on: 'Called')). words add: (TLWhitespace with: (PPToken on: ' ')). 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 := TLPhrasePatternRule named: 'Avoid "So,Called"' rationale: 'rationale' matching: 'so, called'. results := aRule runOn: aDocument. self assert: results size = 0 ! ! !TLPhrasePatternRuleTest methodsFor: 'as yet unclassified' stamp: 'JorgeRessia 11/3/2010 23:07'! testCreationDualWord | aRule | aRule := TLPhrasePatternRule named: 'test' rationale: 'rationale' matching: 'test1 test2'. self assert: aRule name = 'test'. self assert: aRule rationale = 'rationale'. self assert: ( aRule pattern isKindOf: PPFlattenParser ). self assert: ( aRule pattern children size = 1 ). self assert: ( ( aRule pattern children at: 1 ) isKindOf: PPSequenceParser ). self assert: ( ( aRule pattern children at: 1 ) children size = 3 ).! ! !TLPhrasePatternRuleTest methodsFor: 'as yet unclassified' stamp: 'JorgeRessia 11/3/2010 23:08'! testCreationDualWordAndPunctuation | aRule | aRule := TLPhrasePatternRule named: 'test' rationale: 'rationale' matching: 'test1,test2'. self assert: aRule name = 'test'. self assert: aRule rationale = 'rationale'. self assert: ( aRule pattern isKindOf: PPFlattenParser ). self assert: ( aRule pattern children size = 1 ). self assert: ( ( aRule pattern children at: 1 ) isKindOf: PPSequenceParser ). self assert: ( ( aRule pattern children at: 1 ) children size = 3 ).! ! !TLPhrasePatternRuleTest methodsFor: 'as yet unclassified' stamp: 'JorgeRessia 11/3/2010 22:11'! testCreationSingleWord | aRule | aRule := TLPhrasePatternRule named: 'named' rationale: 'rationale' matching: 'test'. self deny: aRule pattern isNil.! ! !TLPhrasePatternRuleTest methodsFor: 'as yet unclassified' stamp: 'JorgeRessia 11/4/2010 09:51'! testDualCommaBetweenWords | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'So')). words add: (TLPunctuationMark with: (PPToken on: ',')). words add: (TLPunctuationMark with: (PPToken on: ',')). words add: (word2 := TLWord with: (PPToken on: 'Called')). words add: (TLWhitespace with: (PPToken on: ' ')). 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 := TLPhrasePatternRule named: 'Avoid "So,Called"' rationale: 'rationale' matching: 'so,called'. results := aRule runOn: aDocument. self assert: results size = 0. ! ! !TLPhrasePatternRuleTest methodsFor: 'as yet unclassified' stamp: 'JorgeRessia 11/4/2010 09:49'! testDualWithespaceBetweenWords | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'So')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'Called')). words add: (TLWhitespace with: (PPToken on: ' ')). 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 := TLPhrasePatternRule named: 'Avoid "So Called"' rationale: 'rationale' matching: 'so called'. 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. ! ! !TLPhrasePatternRuleTest methodsFor: 'as yet unclassified' stamp: 'JorgeRessia 11/4/2010 09:51'! testSingleCommaBetweenWords | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'So')). words add: (TLPunctuationMark with: (PPToken on: ',')). words add: (word2 := TLWord with: (PPToken on: 'Called')). words add: (TLWhitespace with: (PPToken on: ' ')). 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 := TLPhrasePatternRule named: 'Avoid "So,Called"' rationale: 'rationale' matching: 'so,called'. 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. ! ! !TLPhrasePatternRuleTest methodsFor: 'as yet unclassified' stamp: 'JorgeRessia 11/3/2010 22:40'! testSoCalledFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'So')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'Called')). words add: (TLWhitespace with: (PPToken on: ' ')). 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 := TLPhrasePatternRule named: 'Avoid "So Called"' rationale: 'rationale' matching: 'so called'. 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. ! ! 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: #TLQualifiersRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLQualifiersRuleTest methodsFor: 'test' stamp: 'lr 11/2/2010 07:41'! 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 := TLQualifiersRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words size = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule. ! ! !TLQualifiersRuleTest methodsFor: 'test' stamp: 'lr 11/2/2010 07:41'! 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 := TLQualifiersRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results size = 1. self assert: results first isRuleFailure. self assert: results first element isPhrase. self assert: results first element words size = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule. ! ! !TLQualifiersRuleTest methodsFor: 'test' stamp: 'lr 11/2/2010 07:41'! 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 := TLQualifiersRule 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 = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule. ! ! !TLQualifiersRuleTest methodsFor: 'test' stamp: 'lr 11/2/2010 07:41'! 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 := TLQualifiersRule 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 = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule. ! ! !TLQualifiersRuleTest methodsFor: 'test' stamp: 'lr 11/2/2010 07:41'! 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 := TLQualifiersRule 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 = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule.! ! !TLQualifiersRuleTest methodsFor: 'test' stamp: 'lr 11/2/2010 07:41'! 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 := TLQualifiersRule 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 = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule. ! ! !TLQualifiersRuleTest methodsFor: 'test' stamp: 'lr 11/2/2010 07:41'! 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 := TLQualifiersRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! !TLQualifiersRuleTest methodsFor: 'test' stamp: 'lr 11/2/2010 07:41'! 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 := TLQualifiersRule 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 = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule. ! ! 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: #TLRulesArchitectureTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Model'! !TLRulesArchitectureTest methodsFor: 'test' stamp: 'lr 11/3/2010 19:51'! testName TLTextLintRule allRules do: [ :rule | self assert: rule name ~= rule class name. self assert: rule name isString. self assert: rule name isEmpty not. self assert: rule name size < 40 ]! ! !TLRulesArchitectureTest methodsFor: 'test' stamp: 'lr 11/4/2010 10:55'! testPattern | matchingPattern matchingString | TLPatternRule allRules do: [ :rule | matchingPattern := (rule class whichClassIncludesSelector: #matchingPattern) = TLPatternRule. matchingString := (rule class whichClassIncludesSelector: #matchingString) = TLPatternRule. self assert: (matchingPattern or: [ matchingString ]). self deny: (matchingPattern and: [ matchingString ]) ]! ! !TLRulesArchitectureTest methodsFor: 'test' stamp: 'lr 11/3/2010 19:52'! testRationale TLTextLintRule allRules do: [ :rule | self assert: rule rationale ~= rule name. self assert: rule rationale isString. self assert: rule rationale isEmpty not. self assert: rule rationale last = $.. self assert: rule rationale size < 160 ]! ! 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: #TLSoCalledRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLSoCalledRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/2/2010 15:53'! testFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'So')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'Called')). words add: (TLWhitespace with: (PPToken on: ' ')). 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 := TLSoCalledRule 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. ! ! !TLSoCalledRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/2/2010 15:54'! testFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'SO')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'CALLED')). words add: (TLWhitespace with: (PPToken on: ' ')). 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 := TLSoCalledRule 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. ! ! !TLSoCalledRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/2/2010 15:54'! 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: 'so')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'called')). words add: (TLWhitespace with: (PPToken on: ' ')). 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 := TLSoCalledRule 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. ! ! !TLSoCalledRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/2/2010 15:54'! 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: 'on')). 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 := TLSoCalledRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! TestCase subclass: #TLSoOnRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLSoOnRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/2/2010 15:49'! testFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'So')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'on')). words add: (TLWhitespace with: (PPToken on: ' ')). 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 := TLSoOnRule 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. ! ! !TLSoOnRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/2/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: 'SO')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'ON')). words add: (TLWhitespace with: (PPToken on: ' ')). 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 := TLSoOnRule 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. ! ! !TLSoOnRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/2/2010 15:50'! 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: 'so')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'on')). words add: (TLWhitespace with: (PPToken on: ' ')). 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 := TLSoOnRule 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. ! ! !TLSoOnRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/2/2010 15:50'! 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: 'on')). 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 := TLSoOnRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! TestCase subclass: #TLSomehowRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLSomehowRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/1/2010 14:30'! 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. 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 = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule. ! ! !TLSomehowRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/1/2010 14:30'! 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. 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 = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule. ! ! !TLSomehowRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/1/2010 14:30'! 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. 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 = 1. self assert: results first element words first= 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 11/1/2010 15:03'! 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 isRuleFailure. self assert: results first element isPhrase. self assert: results first element words size = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule. ! ! !TLStuffRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/1/2010 15:03'! 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 isRuleFailure. self assert: results first element isPhrase. self assert: results first element words size = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule. ! ! !TLStuffRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/1/2010 15:03'! 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 isRuleFailure. self assert: results first element isPhrase. self assert: results first element words size = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule. ! ! !TLStuffRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/1/2010 15:03'! 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 isRuleFailure. self assert: results first element isPhrase. self assert: results first element words size = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule. ! ! !TLStuffRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/1/2010 15:04'! 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 isRuleFailure. self assert: results first element isPhrase. self assert: results first element words size = 1. self assert: results first element words first= 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 11/3/2010 16:32'! parse: aString ^ self parse: aString tokenizer: TLPlainTokenizer! ! !TLTextParserTest methodsFor: 'utilities' stamp: 'lr 11/3/2010 16:28'! 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: '

Hello World

' tokenizer: TLHtmlTokenizer. self assert: document paragraphs size = 1. self assert: document sentences size = 1. self assert: document words size = 2. self assert: document words first text = 'Hello'. self assert: document words second text = 'World'! ! !TLTextParserTest methodsFor: 'test' stamp: 'lr 5/30/2010 20:02'! testLatexCommandTokenziation | document | document := self parse: '\newcommand[something]{else} common' tokenizer: TLLatexTokenizer. self assert: document paragraphs size = 2. self assert: document sentences size = 2. self assert: document words size = 1. self assert: document words first text = 'common'! ! !TLTextParserTest methodsFor: 'test' stamp: 'lr 5/30/2010 20:02'! testLatexListingTokenziation | document | document := self parse: '\begin{lstlisting}fucking morron\end{lstlisting} \emph{common}' tokenizer: TLLatexTokenizer. self assert: document paragraphs size = 2. self assert: document sentences size = 2. self assert: document words size = 1. self assert: document words first text = 'common'! ! !TLTextParserTest methodsFor: 'test' stamp: 'lr 5/27/2010 16:37'! testLatexTokenziation | document | document := self parse: '\foo\bar{Hello World}' tokenizer: TLLatexTokenizer. self assert: document paragraphs size = 1. self assert: document sentences size = 1. self assert: document words size = 2. self assert: document words first text = 'Hello'. self assert: document words second text = 'World'! ! !TLTextParserTest methodsFor: 'test' stamp: 'lr 9/30/2010 08:27'! testLatexTokenziation2 | document | document := self parse: 'an \ct{AnyOfSetPattern}' tokenizer: TLLatexTokenizer. self assert: document paragraphs size = 1. self assert: document sentences size = 1. self assert: document words size = 2. self assert: document words first text = 'an'. self assert: document words second text = 'AnyOfSetPattern'! ! !TLTextParserTest methodsFor: 'test' stamp: 'lr 4/8/2010 13:48'! testLongParagraph | document | document := self parse: 'A conventional language and development environment should be leveraged as the host instead of introducing a new or derived one. Furthermore embedded languages should not suffer from an additional interpretation layer, but instead run at the same level as the host language. This avoids compatibility problem with existing code, and performance impact of embedded code.'. self assert: document paragraphs size = 1. self assert: document sentences size = 3. self assert: document words size = 55. self assert: document words first text = 'A'. self assert: document words last text = 'code'! ! !TLTextParserTest methodsFor: 'test' stamp: 'lr 4/8/2010 13:49'! testSimpleSentence | document | document := self parse: 'text1 text2.'. self assert: document text = 'text1 text2.'. self assert: document paragraphs size = 1. self assert: document sentences size = 1. self assert: document words size = 2. self assert: document words first text = 'text1'. self assert: document words second text = 'text2'.! ! !TLTextParserTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 16:15'! testTextWithPunctuationMarks | document | document := self parse: 'text1, hal !! text2.'. self assert: document paragraphs size = 1. self assert: document sentences size = 2. self assert: document words size = 3. self assert: document words first text = 'text1'. self assert: document words second text = 'hal'. self assert: document words last text = 'text2'.! ! !TLTextParserTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 16:31'! testTwoParagraphs | document | document := self parse: 'text1 text2. text.'. self assert: document paragraphs size = 2. self assert: document sentences size = 2. self assert: document words size = 3. self assert: document words first text = 'text1'. self assert: document words second text = 'text2'. self assert: document words last text = 'text'! ! TestCase subclass: #TLTheFactIsRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLTheFactIsRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 11:58'! testFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word2 word3 word1 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'The')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'fact')). 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 := TLTheFactIsRule 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. ! ! !TLTheFactIsRuleTest 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: 'THE')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'FACT')). 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 := TLTheFactIsRule 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. ! ! !TLTheFactIsRuleTest 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: 'The')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'fact')). 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 := TLTheFactIsRule 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. ! ! !TLTheFactIsRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 12: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: 'fact')). 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 := TLTheFactIsRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! TestCase subclass: #TLTheFactThatRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLTheFactThatRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 11:58'! 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: 'fact')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word3 := 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 := TLTheFactThatRule 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. ! ! !TLTheFactThatRuleTest 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: 'THE')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'FACT')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word3 := 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 := TLTheFactThatRule 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. ! ! !TLTheFactThatRuleTest 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: 'The')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'fact')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word3 := 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 := TLTheFactThatRule 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. ! ! !TLTheFactThatRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 12: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: 'fact')). 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 := TLTheFactThatRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! TestCase subclass: #TLTheTruthIsRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLTheTruthIsRuleTest methodsFor: 'test' stamp: 'JorgeRessia 5/26/2010 11:58'! 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: (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 := TLTheTruthIsRule 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. ! ! !TLTheTruthIsRuleTest 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: 'THE')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'TRUTH')). 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 := TLTheTruthIsRule 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. ! ! !TLTheTruthIsRuleTest 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: 'The')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'truth')). 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 := TLTheTruthIsRule 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. ! ! !TLTheTruthIsRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 12: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 := TLTheTruthIsRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! TestCase subclass: #TLThingRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLThingRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/1/2010 15:21'! 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: 'THING')). 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 := TLThingRule 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 = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule. ! ! !TLThingRuleTest 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 := TLThingRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! !TLThingRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/1/2010 15:21'! testThingFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (aWord := TLWord with: (PPToken on: 'Thing')). 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 := TLThingRule 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 = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule. ! ! !TLThingRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/1/2010 15:21'! testThingFailureInSentence | 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: 'thing')). 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 := TLThingRule 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 = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule. ! ! !TLThingRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/1/2010 15:21'! testThingsFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (aWord := TLWord with: (PPToken on: 'Things')). 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 := TLThingRule 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 = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule. ! ! !TLThingRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/1/2010 15:21'! testThingsFailureInSentence | 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: 'things')). 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 := TLThingRule 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 = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule. ! ! TestCase subclass: #TLThusRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLThusRuleTest methodsFor: 'test' stamp: 'lr 11/2/2010 12:26'! testFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | aWord := TLWord with: (PPToken on: 'Thus'). 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 := TLThusRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element isPhrase. self assert: results first element size = 1. self assert: results first element children first = aWord. self assert: results first rule = aRule ! ! !TLThusRuleTest methodsFor: 'test' stamp: 'lr 11/2/2010 12:27'! testFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | aWord := TLWord with: (PPToken on: 'ThUs'). 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 := TLThusRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first element isPhrase. self assert: results first element size = 1. self assert: results first element children first = aWord. self assert: results first rule = aRule ! ! !TLThusRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/31/2010 10:47'! 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 := TLThusRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! TestCase subclass: #TLTrueFactRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLTrueFactRuleTest methodsFor: 'test' stamp: 'JorgeRessia 6/10/2010 14:25'! testTrueFactFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'true')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'fact')). 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 := TLTrueFactRule 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. ! ! !TLTrueFactRuleTest methodsFor: 'test' stamp: 'JorgeRessia 6/10/2010 14:33'! testTrueFactFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'TRUE')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'FACT')). 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 := TLTrueFactRule 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. ! ! !TLTrueFactRuleTest methodsFor: 'test' stamp: 'JorgeRessia 6/10/2010 14:33'! testTrueFactFailureInSentence | 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: 'TRUE')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'FACT')). 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 := TLTrueFactRule 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. ! ! !TLTrueFactRuleTest methodsFor: 'test' stamp: 'JorgeRessia 6/10/2010 14:34'! testTrueFactSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'fact')). 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 := TLTrueFactRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! !TLTrueFactRuleTest methodsFor: 'test' stamp: 'JorgeRessia 6/10/2010 14:36'! testTrueFactsFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'true')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'facts')). 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 := TLTrueFactRule 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. ! ! !TLTrueFactRuleTest methodsFor: 'test' stamp: 'JorgeRessia 6/10/2010 14:36'! testTrueFactsFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'TRUE')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'FACTS')). 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 := TLTrueFactRule 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. ! ! !TLTrueFactRuleTest methodsFor: 'test' stamp: 'JorgeRessia 6/10/2010 14:36'! testTrueFactsFailureInSentence | 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: 'TRUE')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (word2 := TLWord with: (PPToken on: 'FACTS')). 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 := TLTrueFactRule 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. ! ! !TLTrueFactRuleTest methodsFor: 'test' stamp: 'JorgeRessia 6/10/2010 14:36'! testTrueFactsSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'facts')). 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 := TLTrueFactRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! TestCase subclass: #TLWhitespaceTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Model'! !TLWhitespaceTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 14:24'! testCreation | aToken | aToken := TLWhitespace with: 1. self assert: aToken text = 1! ! !TLWhitespaceTest methodsFor: 'test' stamp: 'JorgeRessia 4/9/2010 11:53'! testInterval | aToken | aToken := TLWhitespace with: (PPToken on: ' ' start: 1 stop: 1) . self assert: aToken interval size = 1! ! !TLWhitespaceTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 15:14'! testIsEndOfParagraph | aToken aWhitespace| aToken := PPToken on: 'ab ' start: 1 stop: 3. aWhitespace := TLWhitespace with: aToken. self assert: aWhitespace isEndOfParagraph. ! ! !TLWhitespaceTest methodsFor: 'test' stamp: 'JorgeRessia 4/9/2010 14:05'! testIsWhitespace | aToken | aToken := TLWhitespace with: 1. self assert: aToken isWhitespace. self deny: aToken isParagraph. self deny: aToken isDocument. self deny: aToken isSentence. self deny: aToken isWord. self deny: aToken isPunctuation. self deny: aToken isEndOfDocument. self deny: aToken isPhrase.! ! !TLWhitespaceTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 14:25'! testText | aToken | aToken := TLWhitespace with: (PPToken on: '1') . self assert: aToken text = '1'! ! TestCase subclass: #TLWordRepetitionInParagraphRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLWordRepetitionInParagraphRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/12/2010 11:11'! testFailureSingleParagraph | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results word1 word2 word3 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'test')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (TLWord with: (PPToken on: 'lot')). words add: (word2 := TLWord with: (PPToken on: 'test')). words add: (word3 :=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 := TLWordRepetitionInParagraphRule new. results := aRule runOn: aDocument. self assert: results size = 3. self assert: results first = word1. self assert: results second = word2. self assert: results last = word3. ! ! !TLWordRepetitionInParagraphRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/12/2010 11:16'! testFailureTwoParagraph | aRule aWord aDocument anotherWord aSentence words sentences aParagraph anotherParagraph paragraphs results word1 word2 word3 word4 word5 word6 | words := OrderedCollection new. words add: (word1 := TLWord with: (PPToken on: 'test')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (TLWord with: (PPToken on: 'lot')). words add: (word2 := TLWord with: (PPToken on: 'test')). words add: (word3 := TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. words := OrderedCollection new. words add: (word4 := TLWord with: (PPToken on: 'test')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (TLWord with: (PPToken on: 'lot')). words add: (word5 := TLWord with: (PPToken on: 'test')). words add: (word6 := TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. anotherParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph with: anotherParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLWordRepetitionInParagraphRule new. results := aRule runOn: aDocument. self assert: results size = 6. self assert: results first = word1. self assert: results second = word2. self assert: results third = word3. self assert: results fourth = word4. self assert: results fifth = word5. self assert: results sixth = word6. ! ! !TLWordRepetitionInParagraphRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/12/2010 11: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: 'lot')). 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 := TLWordRepetitionInParagraphRule new. results := aRule runOn: aDocument. self assert: results isEmpty. ! ! !TLWordRepetitionInParagraphRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/12/2010 11:21'! testSuccessInTwoParagraphs | aRule aWord aDocument anotherWord aSentence words sentences aParagraph anotherParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (TLWord with: (PPToken on: 'lot')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test1')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWhitespace with: (PPToken on: ' ')). words add: (TLWord with: (PPToken on: 'lot')). words add: (TLWord with: (PPToken on: 'test1')). words add: (TLWord with: (PPToken on: 'test1')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. anotherParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph with: anotherParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLWordRepetitionInParagraphRule new. results := aRule runOn: aDocument. self assert: results isEmpty. ! ! TestCase subclass: #TLWordTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Model'! !TLWordTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 12:01'! testCreation | aWord | aWord := TLWord with: 1. self assert: aWord token = 1! ! !TLWordTest methodsFor: 'test' stamp: 'JorgeRessia 4/9/2010 11:51'! testInterval | aWord | aWord := TLWord with: (PPToken on: '1' start: 1 stop: 1) . self assert: aWord interval size = 1! ! !TLWordTest methodsFor: 'test' stamp: 'JorgeRessia 4/9/2010 14:06'! testIsWord | aWord | aWord := TLWord with: 1. self assert: aWord isWord. self deny: aWord isParagraph. self deny: aWord isDocument. self deny: aWord isSentence. self deny: aWord isPunctuation. self deny: aWord isEndOfDocument. self deny: aWord isWhitespace. self deny: aWord isPhrase.! ! !TLWordTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 12:01'! testText | aWord | aWord := TLWord with: (PPToken on: '1') . self assert: aWord text = '1'! ! TestCase subclass: #TLWouldRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLWouldRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/1/2010 14:31'! testFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (aWord := TLWord with: (PPToken on: 'Would')). 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 := TLWouldRule 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 = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule. ! ! !TLWouldRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/1/2010 14:31'! 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: 'WOULD')). 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 := TLWouldRule 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 = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule. ! ! !TLWouldRuleTest methodsFor: 'test' stamp: 'JorgeRessia 11/1/2010 14:31'! 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: 'would')). 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 := TLWouldRule 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 = 1. self assert: results first element words first= aWord. self assert: results first rule = aRule. ! ! !TLWouldRuleTest methodsFor: 'test' stamp: 'JorgeRessia 7/29/2010 14: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 := TLWouldRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! TestCase subclass: #TLWritingStyleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLWritingStyleTest methodsFor: 'test' stamp: 'JorgeRessia 5/10/2010 11:55'! testCreation | aStyle | aStyle := TLWritingStyle named: 3 formedBy: #(1 2). self assert: (aStyle name = 3). self assert: (aStyle includes: 1). self assert: (aStyle includes: 2)! ! !TLWritingStyleTest methodsFor: 'test' stamp: 'JorgeRessia 5/10/2010 11:58'! testImmutability | aStyle | aStyle := TLWritingStyle named: 3 formedBy: #(1 2). self deny: (aStyle includes: 4). aStyle rules add: 4. self deny: (aStyle includes: 4). ! ! !TLWritingStyleTest methodsFor: 'test' stamp: 'JorgeRessia 5/12/2010 20:33'! testMinusComposition | style1 style2 style3 | style1 := TLWritingStyle named: '1' formedBy: #(3 4). style2 := TLWritingStyle named: '2' formedBy: #(5 4). style3 := style1 - style2. self assert: style3 name = '1 - 2'. self assert: style3 rules size = 1. self assert: (style3 rules includes: 3). ! ! !TLWritingStyleTest methodsFor: 'test' stamp: 'JorgeRessia 5/12/2010 20:29'! testPlusComposition | style1 style2 style3 | style1 := TLWritingStyle named: '1' formedBy: #(3 4). style2 := TLWritingStyle named: '2' formedBy: #(5 6). style3 := style1 + style2. self assert: style3 name = '1 + 2'. self assert: style3 rules size = 4. self assert: (style3 rules includes: 3). self assert: (style3 rules includes: 4). self assert: (style3 rules includes: 5). self assert: (style3 rules includes: 6).! !