SystemOrganization addCategory: #'TextLint-Model'! SystemOrganization addCategory: #'TextLint-Parser'! SystemOrganization addCategory: #'TextLint-Runner'! SystemOrganization addCategory: #'TextLint-Rules'! SystemOrganization addCategory: #'TextLint-Tests'! PPCompositeParser subclass: #TLTextPhraser instanceVariableNames: 'document documentTerminator paragraph paragraphTerminator sentence sentenceTerminator' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Parser'! !TLTextPhraser methodsFor: 'grammar' stamp: 'lr 4/6/2010 22:06'! document ^ (paragraph starLazy: documentTerminator) , (documentTerminator optional) ==> [ :nodes | TLDocument withAll: nodes first ]! ! !TLTextPhraser methodsFor: 'grammar' stamp: 'lr 4/6/2010 22:03'! documentTerminator ^ PPPredicateParser on: [ :token | token isEndOfDocument ] message: 'End of document expected'! ! !TLTextPhraser methodsFor: 'grammar' stamp: 'lr 4/6/2010 22:05'! paragraph ^ (sentence starLazy: paragraphTerminator / documentTerminator) , (paragraphTerminator optional) ==> [ :nodes | TLParagraph withAll: (nodes last isNil ifFalse: [ nodes first copyWith: nodes last ] ifTrue: [ nodes first ]) ]! ! !TLTextPhraser methodsFor: 'grammar' stamp: 'lr 4/6/2010 21:45'! paragraphTerminator ^ PPPredicateParser on: [ :token | token isWhitespace and: [ token isEndOfParagraph ] ] message: 'End of paragraph expected'! ! !TLTextPhraser methodsFor: 'grammar' stamp: 'lr 4/6/2010 22:04'! sentence ^ (#any asParser starLazy: sentenceTerminator / paragraphTerminator / documentTerminator) , (sentenceTerminator optional) ==> [ :nodes | TLSentence withAll: (nodes last isNil ifFalse: [ nodes first copyWith: nodes last ] ifTrue: [ nodes first ]) ]! ! !TLTextPhraser methodsFor: 'grammar' stamp: 'lr 4/6/2010 21:27'! sentenceTerminator ^ PPPredicateParser on: [ :token | token isPunctuation and: [ token isEndOfSentence ] ] message: 'End of sentence expected'! ! !TLTextPhraser methodsFor: 'accessing' stamp: 'lr 4/6/2010 21:43'! start ^ document end! ! PPCompositeParser subclass: #TLTextTokenizer instanceVariableNames: 'punctuation whitespace word elementList element' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Parser'! !TLTextTokenizer methodsFor: 'grammar' stamp: 'lr 4/6/2010 20:20'! element ^ word / whitespace / punctuation! ! !TLTextTokenizer methodsFor: 'grammar' stamp: 'lr 4/6/2010 20:59'! elementList ^ element star ==> [ :token | token copyWith: (TLTerminatorToken on: '') ]! ! !TLTextTokenizer methodsFor: 'tokens' stamp: 'lr 4/6/2010 19:17'! punctuation ^ #any asParser token: TLPunctuationToken! ! !TLTextTokenizer methodsFor: 'accessing' stamp: 'lr 4/6/2010 20:21'! start ^ elementList end! ! !TLTextTokenizer methodsFor: 'tokens' stamp: 'lr 4/6/2010 20:22'! whitespace ^ #space asParser plus token: TLWhitespaceToken! ! !TLTextTokenizer methodsFor: 'tokens' stamp: 'lr 4/6/2010 20:22'! word ^ #word asParser plus token: TLWordToken! ! PPToken subclass: #TLToken instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Model'! TLToken subclass: #TLPunctuationToken instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Model'! !TLPunctuationToken methodsFor: 'testing' stamp: 'lr 4/6/2010 21:47'! isEndOfSentence ^ '.:;!!?' includes: (collection at: start)! ! !TLPunctuationToken methodsFor: 'testing' stamp: 'lr 4/6/2010 20:44'! isPunctuation ^ true! ! TLToken subclass: #TLTerminatorToken instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Model'! !TLTerminatorToken methodsFor: 'testing' stamp: 'lr 4/6/2010 22:04'! isEndOfDocument ^ true! ! !TLToken methodsFor: 'testing' stamp: 'lr 4/6/2010 22:04'! isEndOfDocument ^ false! ! !TLToken methodsFor: 'testing' stamp: 'lr 4/6/2010 20:44'! isPunctuation ^ false! ! !TLToken methodsFor: 'testing' stamp: 'lr 4/6/2010 20:44'! isWhitespace ^ false! ! !TLToken methodsFor: 'testing' stamp: 'lr 4/6/2010 20:45'! isWord ^ false! ! !TLToken methodsFor: 'accessing' stamp: 'lr 4/6/2010 21:56'! text ^ self value! ! !TLToken methodsFor: 'accessing' stamp: 'lr 4/6/2010 21:56'! token ^ self! ! !TLToken methodsFor: 'accessing' stamp: 'lr 4/6/2010 21:56'! tokens ^ Array with: self! ! TLToken subclass: #TLWhitespaceToken instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Model'! !TLWhitespaceToken methodsFor: 'testing' stamp: 'lr 4/6/2010 21:49'! isEndOfParagraph start to: stop do: [ :index | (String crlf includes: (collection at: index)) ifTrue: [ ^ true ] ]. ^ false! ! !TLWhitespaceToken methodsFor: 'testing' stamp: 'lr 4/6/2010 21:45'! isWhitespace ^ true! ! TLToken subclass: #TLWordToken instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Model'! !TLWordToken methodsFor: 'testing' stamp: 'lr 4/6/2010 20:44'! isWord ^ true! ! Object subclass: #TLElement instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Model'! TLElement subclass: #TLDocument instanceVariableNames: 'paragraphs' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Model'! !TLDocument class methodsFor: 'instance creation' stamp: 'lr 3/31/2010 11:15'! withAll: aCollection ^self new initializeWithAll: aCollection! ! !TLDocument methodsFor: 'accessing' stamp: 'lr 4/6/2010 21:15'! children ^ paragraphs! ! !TLDocument methodsFor: 'initialization' stamp: 'lr 4/6/2010 20:25'! initializeFromString: aString! ! !TLDocument methodsFor: 'initialization' stamp: 'lr 3/31/2010 11:16'! initializeWithAll: aCollection paragraphs := aCollection! ! !TLDocument methodsFor: 'accessing' stamp: 'lr 3/31/2010 11:22'! paragraphs ^paragraphs ! ! !TLDocument methodsFor: 'accessing' stamp: 'lr 3/31/2010 11:24'! sentences ^ self paragraphs gather: [ :each | each sentences ]! ! !TLDocument methodsFor: 'accessing' stamp: 'lr 3/31/2010 11:24'! words ^self sentences gather: [ :each | each words ]! ! !TLElement methodsFor: 'accessing' stamp: 'lr 4/6/2010 20:30'! children "Answer the children nodes." ^ #() ! ! !TLElement methodsFor: 'printing' stamp: 'lr 4/6/2010 21:22'! printContentOn: aStream self tokens do: [ :each | aStream nextPutAll: each value ]! ! !TLElement methodsFor: 'printing' stamp: 'lr 4/6/2010 20:29'! printOn: aStream super printOn: aStream. aStream nextPutAll: ' ('. self printContentOn: aStream. aStream nextPut: $)! ! !TLElement methodsFor: 'accessing' stamp: 'lr 4/6/2010 22:09'! text ^ String streamContents: [ :stream | self printContentOn: stream ]! ! !TLElement methodsFor: 'accessing' stamp: 'lr 4/6/2010 21:21'! tokens "Answer the tokens representing the receiver." ^ self children gather: [ :each | each tokens ]! ! TLElement subclass: #TLParagraph instanceVariableNames: 'sentences' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Model'! !TLParagraph class methodsFor: 'instance creation' stamp: 'lr 3/31/2010 11:16'! withAll: aCollection ^self new initializeWithAll: aCollection! ! !TLParagraph methodsFor: 'accessing' stamp: 'lr 4/6/2010 21:15'! children ^ sentences! ! !TLParagraph methodsFor: 'initialization' stamp: 'lr 3/31/2010 11:17'! initializeWithAll: aCollection sentences := aCollection! ! !TLParagraph methodsFor: 'accessing' stamp: 'lr 3/31/2010 11:32'! sentences ^sentences! ! TLElement subclass: #TLSentence instanceVariableNames: 'words' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Model'! !TLSentence class methodsFor: 'instance creation' stamp: 'lr 3/31/2010 11:17'! withAll: aCollection ^self new initializeWithAll: aCollection! ! !TLSentence methodsFor: 'accessing' stamp: 'lr 4/6/2010 21:15'! children ^ words! ! !TLSentence methodsFor: 'testing' stamp: 'lr 4/5/2010 10:25'! containsPhrase: aString ^ self wordsAsString includesSubstring: aString caseSensitive: false! ! !TLSentence methodsFor: 'initialization' stamp: 'lr 3/31/2010 11:17'! initializeWithAll: aCollection words := aCollection! ! !TLSentence methodsFor: 'accessing' stamp: 'lr 3/31/2010 11:20'! words ^ words! ! !TLSentence methodsFor: 'accessing' stamp: 'JorgeRessia 4/6/2010 12:19'! wordsAsString ^words inject: '' into: [:count :each | count, ' ', each token value] ! ! TLElement subclass: #TLWord instanceVariableNames: 'token' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Model'! !TLWord class methodsFor: 'instance creation' stamp: 'JorgeRessia 4/6/2010 12:18'! with: aToken ^self new initializeWith: aToken! ! !TLWord methodsFor: 'initialization' stamp: 'lr 3/31/2010 11:18'! initializeWith: aToken token := aToken! ! !TLWord methodsFor: 'accessing' stamp: 'JorgeRessia 4/6/2010 16:06'! text ^token value! ! !TLWord methodsFor: 'accessing' stamp: 'lr 4/6/2010 21:22'! token ^ token! ! !TLWord methodsFor: 'accessing' stamp: 'lr 4/6/2010 21:22'! tokens ^ Array with: token! ! Object subclass: #TLRuleFailure instanceVariableNames: 'rule element' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Runner'! !TLRuleFailure class methodsFor: 'instance creation' stamp: 'JorgeRessia 4/6/2010 15:54'! on: aRule at: anElement ^self new initializeOn: aRule at: anElement! ! !TLRuleFailure methodsFor: 'accessing' stamp: 'JorgeRessia 4/6/2010 16:00'! element ^ element! ! !TLRuleFailure methodsFor: 'initialization' stamp: 'JorgeRessia 4/6/2010 15:55'! initializeOn: aRule at: anElement rule := aRule. element := anElement! ! !TLRuleFailure methodsFor: 'accessing' stamp: 'JorgeRessia 4/6/2010 16:00'! rule ^ rule! ! Object subclass: #TLTextLintChecker instanceVariableNames: 'rules results' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Runner'! !TLTextLintChecker methodsFor: 'accessing' stamp: 'JorgeRessia 3/31/2010 16:49'! addRule: aRule rules add: aRule! ! !TLTextLintChecker methodsFor: 'public' stamp: 'lr 4/6/2010 22:21'! check: aString | aDocument | aDocument := TLTextPhraser parse: (TLTextTokenizer parse: aString). self checkDocument: aDocument.! ! !TLTextLintChecker methodsFor: 'mocking' stamp: 'JorgeRessia 4/6/2010 15:58'! checkDocument: aDocument results := rules gather: [ :rule | (rule runOn: aDocument) collect: [:element | TLRuleFailure on: rule at: element]]! ! !TLTextLintChecker methodsFor: 'initializing' stamp: 'JorgeRessia 3/31/2010 16:50'! initialize rules := OrderedCollection new! ! !TLTextLintChecker methodsFor: 'accessing' stamp: 'JorgeRessia 4/6/2010 11:36'! results ^results! ! Object subclass: #TLTextLintRule instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Rules'! TLTextLintRule subclass: #TLALotRule instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Rules'! !TLALotRule methodsFor: 'accessing' stamp: 'JorgeRessia 4/6/2010 10:51'! rationale ^ 'Avoid using a lot, it weakens the sentence'! ! !TLALotRule methodsFor: 'running' stamp: 'JorgeRessia 4/6/2010 10:52'! runOn: aDocument | results | results := OrderedCollection new. aDocument sentences do: [:eachSentence | (eachSentence containsPhrase: 'a lot') ifTrue: [ results add: eachSentence] ]. ^results ! ! TLTextLintRule subclass: #TLAllowToRule instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Rules'! !TLAllowToRule methodsFor: 'accessing' stamp: 'JorgeRessia 4/4/2010 10:19'! rationale ^ 'Never use the expressions "allow/s to". This expression requires a direct object.'! ! !TLAllowToRule methodsFor: 'running' stamp: 'JorgeRessia 4/5/2010 10:50'! runOn: aDocument | results | results := OrderedCollection new. aDocument sentences do: [:eachSentence | ((eachSentence containsPhrase: 'allow to') or: [eachSentence containsPhrase: 'allows to']) ifTrue: [ results add: eachSentence] ]. ^ results. ! ! TLTextLintRule subclass: #TLAsToWhetherRule instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Rules'! !TLAsToWhetherRule methodsFor: 'accessing' stamp: 'JorgeRessia 4/2/2010 18:01'! rationale ^ 'Words and expressions commonly missused - as to whether -> it is enough with whether'! ! !TLAsToWhetherRule methodsFor: 'running' stamp: 'JorgeRessia 4/5/2010 10:50'! runOn: aDocument | results | results := OrderedCollection new. aDocument sentences do: [:eachSentence | (eachSentence containsPhrase: 'as to whether') ifTrue: [ results add: eachSentence] ]. ^results ! ! TLTextLintRule subclass: #TLAvoidQualifiersRule instanceVariableNames: 'qualifiers' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Rules'! !TLAvoidQualifiersRule methodsFor: 'initialization' stamp: 'lr 4/6/2010 22:25'! initialize super initialize. self initializeQualifiers.! ! !TLAvoidQualifiersRule methodsFor: 'initialization' stamp: 'lr 4/6/2010 22:25'! initializeQualifiers qualifiers := OrderedCollection new. qualifiers add: 'rather'; add: 'very'; add: 'pretty'; add: 'little'; add: 'quite'. ! ! !TLAvoidQualifiersRule methodsFor: 'accessing' stamp: 'JorgeRessia 4/2/2010 18:10'! rationale ^ 'Avoid the use of qualifiers. These are the leeches that infest the pond of prose, sucking the blood of words. The constant use of the adjective little (except to indicate size) is particularly debilitating; we should all try to do a little better, we should all be very watchful of this rule, for it is a rather important one, and we are pretty sure to violate it now and then. Rule 8, An approach to Style - The Elements of Style - W. Strunk and E.B. White'! ! !TLAvoidQualifiersRule methodsFor: 'running' stamp: 'JorgeRessia 4/5/2010 10:50'! runOn: aDocument | results | results := OrderedCollection new. aDocument words do: [:eachWord | ( qualifiers includes: eachWord text translateToLowercase ) ifTrue: [ results add: eachWord]]. ^results ! ! TLTextLintRule subclass: #TLHelpToRule instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Rules'! !TLHelpToRule methodsFor: 'accessing' stamp: 'JorgeRessia 4/4/2010 10:41'! rationale ^ 'Never use the expressions "help/s to". This expression requires a direct object.'! ! !TLHelpToRule methodsFor: 'running' stamp: 'JorgeRessia 4/5/2010 10:50'! runOn: aDocument | results | results := OrderedCollection new. aDocument sentences do: [:eachSentence | ((eachSentence containsPhrase: 'help to') or: [eachSentence containsPhrase: 'helps to']) ifTrue: [ results add: eachSentence] ]. ^results ! ! TLTextLintRule subclass: #TLHoweverRule instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Rules'! !TLHoweverRule methodsFor: 'accessing' stamp: 'JorgeRessia 4/2/2010 18:13'! rationale ^ 'Avoid starting a sentence with however when the meaning is nevertheless. The word usually serves when not in first possition. Misused words and expressions (page 48) - The Elements of Style - W. Strunk and E.B. White'! ! !TLHoweverRule methodsFor: 'running' stamp: 'JorgeRessia 4/5/2010 10:50'! runOn: aDocument | results | results := OrderedCollection new. aDocument sentences do: [:eachSentence | (eachSentence words first text = 'However') ifTrue: [ results add: eachSentence] ]. ^results ! ! TLTextLintRule subclass: #TLOneOfTheMostRule instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Rules'! !TLOneOfTheMostRule methodsFor: 'accessing' stamp: 'JorgeRessia 4/2/2010 18:16'! rationale ^ 'Avoid this feeble formula. There is nothing wrong with the grammar the formula is simple threadbare. Misused words and expressions (page 55) - The Elements of Style - W. Strunk and E.B. White'! ! !TLOneOfTheMostRule methodsFor: 'running' stamp: 'JorgeRessia 4/5/2010 10:50'! runOn: aDocument | results | results := OrderedCollection new. aDocument sentences do: [:eachSentence | (eachSentence containsPhrase: 'one of the most') ifTrue: [ results add: eachSentence] ]. ^results. ! ! TLTextLintRule subclass: #TLRegardedAsBeingRule instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Rules'! !TLRegardedAsBeingRule methodsFor: 'accessing' stamp: 'JorgeRessia 4/2/2010 18:19'! rationale ^ 'Being is not appropriate after regard...as. Misused words and expressions (page 41) - The Elements of Style - W. Strunk and E.B. White'! ! !TLRegardedAsBeingRule methodsFor: 'running' stamp: 'JorgeRessia 4/5/2010 10:50'! runOn: aDocument | results | results := OrderedCollection new. aDocument sentences do: [:eachSentence | (eachSentence containsPhrase: 'regarded as being') ifTrue: [ results add: eachSentence] ]. ^results ! ! TLTextLintRule subclass: #TLRequireToRule instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Rules'! !TLRequireToRule methodsFor: 'accessing' stamp: 'JorgeRessia 4/4/2010 10:25'! rationale ^ 'Never use the expressions "require/s to". This expression requires a direct object.'! ! !TLRequireToRule methodsFor: 'running' stamp: 'JorgeRessia 4/5/2010 10:50'! runOn: aDocument | results | results := OrderedCollection new. aDocument sentences do: [:eachSentence | ((eachSentence containsPhrase: 'require to') or: [eachSentence containsPhrase: 'requires to']) ifTrue: [ results add: eachSentence] ]. ^results ! ! !TLTextLintRule methodsFor: 'public' stamp: 'JorgeRessia 4/1/2010 12:10'! check: anObject ! ! !TLTextLintRule methodsFor: 'accessing' stamp: 'JorgeRessia 4/2/2010 17:44'! rationale ^ self subclassResponsibility! ! !TLTextLintRule methodsFor: 'running' stamp: 'JorgeRessia 4/5/2010 10:29'! runOn: aDocument ^self subclassResponsibility! ! TLTextLintRule subclass: #TLTheFactIsRule instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Rules'! !TLTheFactIsRule methodsFor: 'accessing' stamp: 'JorgeRessia 4/2/2010 18:30'! rationale ^ 'A bad beginning for a sentence. If you think you are possessed of the truth or fact state it. Principles of composition (page 60) - The Elements of Style - W. Strunk and E.B. White'! ! !TLTheFactIsRule methodsFor: 'running' stamp: 'JorgeRessia 4/5/2010 10:51'! runOn: aDocument | results | results := OrderedCollection new. aDocument sentences do: [:eachSentence | (eachSentence containsPhrase: 'the fact is') ifTrue: [ results add: eachSentence] ]. ^results ! ! TLTextLintRule subclass: #TLTheFactThatRule instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Rules'! !TLTheFactThatRule methodsFor: 'accessing' stamp: 'JorgeRessia 4/2/2010 18:21'! rationale ^ 'The fact that is an especially debilitating expression. Principles of composition (page 24) - The Elements of Style - W. Strunk and E.B. White'! ! !TLTheFactThatRule methodsFor: 'running' stamp: 'JorgeRessia 4/5/2010 10:51'! runOn: aDocument | results | results := OrderedCollection new. aDocument sentences do: [:eachSentence | (eachSentence containsPhrase: 'the fact that') ifTrue: [ results add: eachSentence] ]. ^results ! ! TLTextLintRule subclass: #TLTheTruthIsRule instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Rules'! !TLTheTruthIsRule methodsFor: 'accessing' stamp: 'JorgeRessia 4/2/2010 18:30'! rationale ^ 'A bad beginning for a sentence. If you think you are possessed of the truth or fact state it. Principles of composition (page 60) - The Elements of Style - W. Strunk and E.B. White'! ! !TLTheTruthIsRule methodsFor: 'running' stamp: 'JorgeRessia 4/5/2010 10:51'! runOn: aDocument | results | results := OrderedCollection new. aDocument sentences do: [:eachSentence | (eachSentence containsPhrase: 'the truth is') ifTrue: [ results add: eachSentence] ]. ^results ! ! TLTextLintRule subclass: #TLWordRepetitionRule instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Rules'! !TLWordRepetitionRule methodsFor: 'accessing' stamp: 'JorgeRessia 4/2/2010 18:22'! rationale ^ 'Detection of words repetion'! ! !TLWordRepetitionRule methodsFor: 'running' stamp: 'JorgeRessia 4/6/2010 15:49'! runOn: aDocument | words results | results := OrderedCollection new. aDocument sentences do: [:eachSentence | words := eachSentence words asArray. 2 to: words size do: [:index | ((words at: index) text translateToLowercase = (words at: index - 1) text translateToLowercase) ifTrue: [ results add: eachSentence] ] ]. ^results ! ! TestCase subclass: #TLALotRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests'! !TLALotRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/6/2010 10:53'! 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. ! ! !TLALotRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/6/2010 10: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. ! ! !TLALotRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/6/2010 15:36'! 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'! !TLAllowToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/5/2010 10:29'! 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. ! ! !TLAllowToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/5/2010 10:29'! 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. ! ! !TLAllowToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/6/2010 15:38'! 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/5/2010 10:30'! 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. ! ! !TLAllowToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/5/2010 10:30'! 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. ! ! !TLAllowToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/6/2010 15:38'! 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'! !TLAsToWhetherRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/5/2010 10:36'! 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. ! ! !TLAsToWhetherRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/5/2010 10:37'! 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. ! ! !TLAsToWhetherRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/6/2010 15: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: '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'! !TLAvoidQualifiersRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/5/2010 10:37'! 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. ! ! !TLAvoidQualifiersRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/5/2010 10:37'! 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. ! ! !TLAvoidQualifiersRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/5/2010 10:37'! 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. ! ! !TLAvoidQualifiersRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/5/2010 10:37'! 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. ! ! !TLAvoidQualifiersRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/5/2010 10:38'! 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. ! ! !TLAvoidQualifiersRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/6/2010 15:38'! 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/5/2010 10:38'! 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. ! ! TestCase subclass: #TLDocumentTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests'! !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/4/2010 13:40'! 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/4/2010 13:44'! 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'! !TLHelpToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/5/2010 10:38'! 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. ! ! !TLHelpToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/5/2010 10:38'! 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. ! ! !TLHelpToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/6/2010 15:38'! 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/5/2010 10:39'! 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 size = 1. ! ! !TLHelpToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/5/2010 10:39'! 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. ! ! !TLHelpToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/6/2010 15:38'! 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'! !TLHoweverRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/5/2010 10:39'! 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. ! ! !TLHoweverRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/6/2010 15:38'! 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'! !TLOneOfTheMostRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/5/2010 10:40'! 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. ! ! !TLOneOfTheMostRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/6/2010 15:38'! 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'! !TLParagraphTest methodsFor: 'test' stamp: 'JorgeRessia 4/4/2010 13:22'! testCreation | aParagraph | aParagraph := TLParagraph withAll: 1. self assert: aParagraph sentences = 1! ! TestCase subclass: #TLRegardedAsBeingRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests'! !TLRegardedAsBeingRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/5/2010 10:40'! 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. ! ! !TLRegardedAsBeingRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/5/2010 10:40'! 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. ! ! !TLRegardedAsBeingRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/6/2010 15: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: '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'! !TLRequireToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/5/2010 10:41'! 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. ! ! !TLRequireToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/5/2010 10:41'! 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. ! ! !TLRequireToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/6/2010 15:38'! 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/5/2010 10:41'! 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 size = 1. ! ! !TLRequireToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/5/2010 10:42'! 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. ! ! !TLRequireToRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/6/2010 15:38'! 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'! TestCase subclass: #TLRulesArchitectureTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests'! !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'! !TLSentenceTest class methodsFor: 'accessing' stamp: 'lr 4/5/2010 00:55'! packageNamesUnderTest ^ #('TextLint-Tests')! ! !TLSentenceTest methodsFor: 'test' stamp: 'JorgeRessia 4/2/2010 08:42'! 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/2/2010 08:57'! 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/2/2010 08:56'! 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/2/2010 08:58'! 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/4/2010 13:12'! testCreation | aSentence | aSentence := TLSentence withAll: 1. self assert: aSentence words = 1! ! !TLSentenceTest methodsFor: 'test' stamp: 'JorgeRessia 4/4/2010 13:16'! 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/6/2010 12:03'! 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: #TLTextLintCheckerTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests'! !TLTextLintCheckerTest methodsFor: 'test' stamp: 'lr 4/6/2010 22:25'! 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'! !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'! !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: 'lr 4/6/2010 22: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 = 4. self assert: document words first value = 'text1'. self assert: document words third value = 'text2'.! ! !TLTextParserTest methodsFor: 'test' stamp: 'lr 4/6/2010 22:18'! 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 = 9. self assert: document words first value = 'text1'. self assert: document words second value = ','. self assert: document words last value = '.'.! ! !TLTextParserTest methodsFor: 'test' stamp: 'lr 4/6/2010 22:19'! 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 = 7. self assert: document words first value = 'text1'. self assert: document words second value = 'text2'. self assert: document words last value = '.'! ! TestCase subclass: #TLTheFactIsRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests'! !TLTheFactIsRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/5/2010 10:42'! 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. ! ! !TLTheFactIsRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/5/2010 10: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: '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. ! ! !TLTheFactIsRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/6/2010 15: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: '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'! !TLTheFactThatRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/5/2010 10:45'! 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. ! ! !TLTheFactThatRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/5/2010 10:45'! 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. ! ! !TLTheFactThatRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/6/2010 15: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: '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'! !TLTheTruthIsRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/5/2010 10:46'! 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. ! ! !TLTheTruthIsRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/5/2010 10:46'! 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. ! ! !TLTheTruthIsRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/6/2010 15: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: '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: #TLWordRepetitionRuleTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Tests'! !TLWordRepetitionRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/5/2010 10:46'! 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. ! ! !TLWordRepetitionRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/6/2010 09:22'! 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. ! ! !TLWordRepetitionRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/5/2010 10:46'! testFailureManyWords | aRule aWord aDocument anotherWord aSentence words sentences aParagraph paragraphs results | words := OrderedCollection new. words add: (TLWord with: (PPToken on: 'tes')). words add: (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. ! ! !TLWordRepetitionRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/5/2010 10:46'! testFailureThreeInRow | 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: '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. ! ! !TLWordRepetitionRuleTest methodsFor: 'test' stamp: 'JorgeRessia 4/6/2010 15:38'! 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'! !TLWordTest methodsFor: 'test' stamp: 'JorgeRessia 4/4/2010 13:09'! testCreation | aWord | aWord := TLWord with: 1. self assert: aWord token = 1! ! !TLWordTest methodsFor: 'test' stamp: 'JorgeRessia 4/4/2010 13:10'! testText | aWord | aWord := TLWord with: (PPToken on: '1') . self assert: aWord text = '1'! !