Lukas Renggli wrote:
Hi Stan,
Some are failing, as there are $' characters being passed through from the parser. Also, the literals check sees to be checking the node, rather than the node value.
You are right, the code that extracted arguments and temps unnecessarily put the names into $' characters. This is totally wrong and also breaks the highlighting in the browser. Instead of changing the tokenizer (as you proposed) I fixed the places where the nodes were collected. Like this there should be no more $' characters in the strings that are checked.
Name: Refactoring-Spelling-lr.10 Author: lr Time: 12 January 2010, 12:16:16 am UUID: b40774a4-8371-42f4-883c-469d6fe1e020 Ancestors: Refactoring-Spelling-lr.9
- fixed the bug pointed out by Stan Shepherd that temps and arguments were not properly checked - this also fixes the issue of not highlighting typos in temps and arguments (which I looked into earlier today, but couldn't figure out the real cause)
There are some suggested changes in the same repository, that make the tests run green, and don't appear to affect the rest of Refactoring-Tests.
The tests are really cool. I would like to add them to the main repository, but two are broken depending on what checker is used:
RBMacSpellChecker: #testLiteralValues and #testPoolVariable RBInternalSpellChecker: #testLiteralValues and #testClassComments
Maybe that could be fixed by always using the internal one for the tests, but then I don't understand why the tests break. Does my fix not solve the whole problem?
Lukas
Hi, there are still $' present. Don't know if it's possible to strip them out earlier again. The following methods again strip leading and trailing '. They validate correctly, including 'don''t'. They are in Squeaksource RBBugFixes. So is a new version of the tests, that test spelling of 'don''t'. It also checks all the tests are run- one got lost in transcription last time. Also, the name of the Pool Dictionary test got reverted. ...Stan RBSpellChecker>>normalize: aString "Filter out non alphabetical characters, remove prefixes as commonly found in class names, split camel case expressions and filter out one character words." | result input output activeString | result := Set new. input := aString readStream. output := WriteStream on: (String new: 128). [ input atEnd ] whileFalse: [ [ input atEnd not and: [ input peek isLetter or: [ input peek = $' ] ] ] whileTrue: [ output nextPut: input next ]. output position = 0 ifTrue: [ input next ] ifFalse: [ | stream | stream := output contents readStream. [ stream atEnd ] whileFalse: [ output reset; nextPut: stream next. [ stream atEnd not and: [ stream peek isLowercase or: [ stream peek = $' ] ] ] whileTrue: [ output nextPut: stream next ]. "at this point we have allowed through $' to allow don't. We can also have leading or trailing $', if a comment contains eg 'WB' or 'NASA' " activeString := self copyWithoutLeadingTrailingSingleQuotes: output contents . activeString size > 1 ifTrue: [ result add: activeString ] ] ]. output reset ]. ^ result RBSpellChecker>>copyWithoutLeadingTrailingSingleQuotes: aByteString | startPosition endPosition | startPosition := 1. [ (aByteString at: startPosition) = $' ] whileTrue: [ startPosition := startPosition + 1. startPosition > aByteString size ifTrue: [ ^ '' ] ]. endPosition := aByteString size. [ (aByteString at: endPosition) = $' ] whileTrue: [ endPosition := endPosition - 1. endPosition < 1 ifTrue: [ ^ '' ] ]. ^ aByteString copyFrom: startPosition to: endPosition -- View this message in context: http://n2.nabble.com/Spell-check-test-cases-tp4288633p4292584.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.