SystemOrganization addCategory: #'TextLint-Tests-Model'! SystemOrganization addCategory: #'TextLint-Tests-Parser'! SystemOrganization addCategory: #'TextLint-Tests-Runner'! SystemOrganization addCategory: #'TextLint-Tests-Rules'! TestCase subclass: #TLALotRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLALotRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 22:52'! testFailure | 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: '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 = aSentence. ! ! !TLALotRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/8/2010 13:33'! testFailureCaseInsensitive | 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: '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 = aSentence. ! ! !TLALotRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 22:54'! 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: (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 = aSentence. ! ! !TLALotRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 11: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: '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 := TLTheFactThatRule new. results := aRule runOn: aDocument. self assert: results isEmpty. ! ! TestCase subclass: #TLAllowToRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLAllowToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 22:54'! testAllowToFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results| words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'Allow')). 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 = aSentence. ! ! !TLAllowToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/8/2010 13:33'! testAllowToFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results| words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'Allow')). 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 = aSentence. ! ! !TLAllowToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 22:54'! 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: (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 = aSentence. ! ! !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 4/7/2010 22:54'! testAllowsToFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'Allows')). 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 = aSentence. ! ! !TLAllowToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/8/2010 13:34'! testAllowsToFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'ALLOWS')). 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 = aSentence. ! ! !TLAllowToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 22:54'! 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: (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 = aSentence. ! ! !TLAllowToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 11:55'! 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: '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! ! TestCase subclass: #TLAsToWhetherRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLAsToWhetherRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 22:55'! testFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'As')). 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 size = 1. self assert: results first = aSentence. ! ! !TLAsToWhetherRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/8/2010 13:34'! testFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'AS')). 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 size = 1. self assert: results first = aSentence. ! ! !TLAsToWhetherRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 22:55'! 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: (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 size = 1. self assert: results first = aSentence. ! ! !TLAsToWhetherRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 11:55'! testSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'to')). words add: (TLWord with: (PPToken on: 'whether')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAsToWhetherRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! TestCase subclass: #TLAvoidQualifiersRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLAvoidQualifiersRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 22:56'! testCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | aWord := TLWord with: (PPToken on: 'Rather'). anotherWord := TLWord with: (PPToken on: 'test'). words := OrderedCollection with: aWord with: anotherWord. aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAvoidQualifiersRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first = aWord. ! ! !TLAvoidQualifiersRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 22:56'! testLittleFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | aWord := TLWord with: (PPToken on: 'little'). anotherWord := TLWord with: (PPToken on: 'test'). words := OrderedCollection with: aWord with: anotherWord. aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAvoidQualifiersRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first = aWord. ! ! !TLAvoidQualifiersRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 22:56'! testPrettyFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | aWord := TLWord with: (PPToken on: 'pretty'). anotherWord := TLWord with: (PPToken on: 'test'). words := OrderedCollection with: aWord with: anotherWord. aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAvoidQualifiersRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first = aWord. ! ! !TLAvoidQualifiersRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 22:56'! testQuiteFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | aWord := TLWord with: (PPToken on: 'quite'). anotherWord := TLWord with: (PPToken on: 'test'). words := OrderedCollection with: aWord with: anotherWord. aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAvoidQualifiersRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first = aWord. ! ! !TLAvoidQualifiersRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 22:56'! testRatherFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | aWord := TLWord with: (PPToken on: 'rather'). anotherWord := TLWord with: (PPToken on: 'test'). words := OrderedCollection with: aWord with: anotherWord. aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAvoidQualifiersRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first = aWord. ! ! !TLAvoidQualifiersRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 11:56'! testSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | aWord := TLWord with: (PPToken on: 'test'). anotherWord := TLWord with: (PPToken on: 'test'). words := OrderedCollection with: aWord with: anotherWord. aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAvoidQualifiersRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! !TLAvoidQualifiersRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 22:56'! testVeryFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | aWord := TLWord with: (PPToken on: 'very'). anotherWord := TLWord with: (PPToken on: 'test'). words := OrderedCollection with: aWord with: anotherWord. aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLAvoidQualifiersRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first = aWord. ! ! TestCase subclass: #TLDocumentTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Model'! !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/7/2010 12:16'! 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.! ! !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/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: #TLHelpToRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLHelpToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 22:57'! testHelpToFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'Help')). 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 = aSentence. ! ! !TLHelpToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/8/2010 13:34'! testHelpToFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'HELP')). 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 = aSentence. ! ! !TLHelpToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 22:57'! 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: (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 = aSentence. ! ! !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 4/7/2010 22:57'! testHelpsToFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'Helps')). 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 first = aSentence. self assert: results size = 1. ! ! !TLHelpToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/8/2010 13:35'! testHelpsToFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'HELPS')). 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 first = aSentence. self assert: results size = 1. ! ! !TLHelpToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 22:57'! 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: (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 = aSentence. ! ! !TLHelpToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 11:58'! testHelpsToSuccess | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'helps')). words add: (TLWord with: (PPToken on: 'that')). words add: (TLWord with: (PPToken on: 'test')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLHelpToRule new. results := aRule runOn: aDocument. self assert: results isEmpty! ! TestCase subclass: #TLHoweverRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLHoweverRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/8/2010 12:17'! 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 = aWord. ! ! !TLHoweverRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/8/2010 12:18'! 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 = aWord. ! ! !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: #TLOneOfTheMostRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLOneOfTheMostRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 22:58'! testFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'One')). 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 size = 1. self assert: results first = aSentence. ! ! !TLOneOfTheMostRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/8/2010 13:35'! testFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'ONE')). 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 size = 1. self assert: results first = aSentence. ! ! !TLOneOfTheMostRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 22:59'! testFailureInSentence | 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: 'One')). 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 size = 1. self assert: results first = aSentence. ! ! !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/7/2010 12:15'! 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.! ! TestCase subclass: #TLPhraseTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Model'! !TLPhraseTest class methodsFor: 'accessing' stamp: 'JorgeRessia 4/8/2010 14:58'! packageNamesUnderTest ^ #('TextLint-Tests')! ! !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/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/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/7/2010 13:53'! 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.! ! !TLPunctuationMarkTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 13:54'! testText | aToken | aToken := TLPunctuationMark with: (PPToken on: '1') . self assert: aToken text = '1'! ! TestCase subclass: #TLRegardedAsBeingRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLRegardedAsBeingRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 22:59'! testFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'Regarded')). 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 size = 1. self assert: results first = aSentence. ! ! !TLRegardedAsBeingRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/8/2010 13:36'! testFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'REGARDED')). 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 size = 1. self assert: results first = aSentence. ! ! !TLRegardedAsBeingRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 22:59'! 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: 'Regarded')). 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 size = 1. self assert: results first = aSentence. ! ! !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 4/7/2010 23:00'! testRequireToFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'Require')). 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 := TLRequireToRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first = aSentence. ! ! !TLRequireToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/8/2010 13:36'! testRequireToFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'REQUIRE')). 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 := TLRequireToRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first = aSentence. ! ! !TLRequireToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 23:00'! testRequireToFailureInSentence | 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: 'Require')). 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 := TLRequireToRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first = aSentence. ! ! !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 4/7/2010 23:00'! testRequiresToFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'Requires')). 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 := TLRequireToRule new. results := aRule runOn: aDocument. self assert: results first = aSentence. self assert: results size = 1. ! ! !TLRequireToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/8/2010 13:36'! testRequiresToFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'REQUIRES')). 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 := TLRequireToRule new. results := aRule runOn: aDocument. self assert: results first = aSentence. self assert: results size = 1. ! ! !TLRequireToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 23:00'! testRequiresToFailureInSentence | 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: 'Requires')). 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 := TLRequireToRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first = aSentence. ! ! !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-Rules'! !TLRulesArchitectureTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 22:34'! testName TLTextLintRule allSubclassesDo: [ :aClass | aClass new name size > 10 ]. ! ! !TLRulesArchitectureTest methodsFor: 'test' stamp: 'JorgeRessia 4/2/2010 17:54'! testRationale TLTextLintRule allSubclassesDo: [ :aClass | aClass new rationale size > 10]. ! ! TestCase subclass: #TLSentenceTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Model'! !TLSentenceTest class methodsFor: 'accessing' stamp: 'lr 4/5/2010 00:55'! packageNamesUnderTest ^ #('TextLint-Tests')! ! !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/7/2010 12:17'! 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.! ! !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: #TLStuffRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLStuffRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/8/2010 14:20'! 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 = aWord. ! ! !TLStuffRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/8/2010 14:22'! 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 = aWord. ! ! !TLStuffRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/8/2010 14:22'! 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 = aWord. ! ! !TLStuffRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/8/2010 14:22'! 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 = aWord. ! ! !TLStuffRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/8/2010 14:23'! 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 = aWord. ! ! !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/7/2010 14:20'! 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.! ! !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/7/2010 12:00'! testCheckSingleRule | aChecker | aChecker := TLTextLintChecker new. aChecker addRule: (TLALotRule new). aChecker check: 'test a lot that.'. self assert: ( aChecker results size = 1 ). self assert: ( aChecker results first element wordsAsString = ' test a lot that' ). self assert: ( aChecker results first rule class = TLALotRule ) ! ! TestCase subclass: #TLTextLintRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLTextLintRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/1/2010 12:10'! test | aRule | aRule := TLTextLintRule new. aRule check: 1. self assert: true.! ! TestCase subclass: #TLTextParserTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Parser'! !TLTextParserTest methodsFor: 'utilities' stamp: 'lr 4/6/2010 22:16'! parse: aString | document | document := TLTextPhraser parse: (TLTextTokenizer parse: aString) onError: [ :err | self error: err printString ]. self assert: document text = aString description: 'Parse invariant not satisfied'. ^ document! ! !TLTextParserTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 16:14'! testSimple | 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 4/7/2010 23:00'! testFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'The')). 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 size = 1. self assert: results first = aSentence. ! ! !TLTheFactIsRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/8/2010 13:37'! testFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'THE')). 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 size = 1. self assert: results first = aSentence. ! ! !TLTheFactIsRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 23:01'! 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: 'The')). 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 size = 1. self assert: results first = aSentence. ! ! !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 4/7/2010 23:01'! testFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'The')). 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 size = 1. self assert: results first = aSentence. ! ! !TLTheFactThatRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/8/2010 13:37'! testFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'THE')). 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 size = 1. self assert: results first = aSentence. ! ! !TLTheFactThatRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 23:01'! 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: 'The')). 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 size = 1. self assert: results first = aSentence. ! ! !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 4/7/2010 23:01'! testFailure | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'The')). 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 size = 1. self assert: results first = aSentence. ! ! !TLTheTruthIsRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/8/2010 13:32'! testFailureCaseInsensitive | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'THE')). 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 size = 1. self assert: results first = aSentence. ! ! !TLTheTruthIsRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 23:01'! 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: 'The')). 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 size = 1. self assert: results first = aSentence. ! ! !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 4/8/2010 14:15'! 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 = aWord. ! ! !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 4/8/2010 14:23'! 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 = aWord. ! ! !TLThingRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/8/2010 14:16'! 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 = aWord. ! ! !TLThingRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/8/2010 14:23'! 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 = aWord. ! ! !TLThingRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/8/2010 14:16'! 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 = aWord. ! ! 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/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/7/2010 14:25'! 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.! ! !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: #TLWordRepetitionRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests-Rules'! !TLWordRepetitionRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/8/2010 12:11'! 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 := TLWordRepetitionRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first = aWord. ! ! !TLWordRepetitionRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/8/2010 12:11'! 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 := TLWordRepetitionRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first = aWord. ! ! !TLWordRepetitionRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/8/2010 12:13'! testFailureManyWords | aRule aDocument anotherWord aSentence words sentences aParagraph paragraphs results aWord | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'tes')). words add: (aWord := TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'xxxx')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLWordRepetitionRule new. results := aRule runOn: aDocument. self assert: results size = 1. self assert: results first = aWord. ! ! !TLWordRepetitionRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/8/2010 12:14'! testFailureThreeInRow | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (aWord := TLWord with: (PPToken on: 'test')). words add: (anotherWord := TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'test')). words add: (TLWord with: (PPToken on: 'xxxx')). aSentence := TLSentence withAll: words. sentences := OrderedCollection with: aSentence. aParagraph := TLParagraph withAll: sentences. paragraphs := OrderedCollection with: aParagraph. aDocument := TLDocument withAll: paragraphs. aRule := TLWordRepetitionRule new. results := aRule runOn: aDocument. self assert: results size = 2. self assert: results first = aWord. self assert: results second = anotherWord. ! ! !TLWordRepetitionRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 12:01'! 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 := TLWordRepetitionRule 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/7/2010 12:20'! 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.! ! !TLWordTest methodsFor: 'test' stamp: 'JorgeRessia 4/7/2010 12:01'! testText | aWord | aWord := TLWord with: (PPToken on: '1') . self assert: aWord text = '1'! !