Hi guys: I'm working on adding new test for the String class to improve the test coverage.
Rigth now, the string class has 75,42% of coverage. I found out thanks to Hapao.
Well, these ones are methods that I don't understand. what are they used for? how can I use them?
Please, could you help me to understand them, in order to do write some test cases? Cheers,
Dani |
Hello, I believe #correctAgainstDictionary: / correctAgainst: / correctAgainstEnumerator: are API for autocorrection in compiler erros / compiler warnings.
For ex, when I type '1 hal' in a workspace I get this window:
and here all the selector proposed (hasPreambleOfRemoval, haltIfNil, ...) are found in a correctAgainst: method. Here the method called was probably something like 'hal' correctAgainst: all the possible selector. If you are in a method editor for a specific class and you write the name of a variable that does not exist, this window will propose you to either create a new variable or choose in a list of existing variable, in this case you would call something like 'incorrectlyWrittenVaName' correctAgainst: allPossibleVariableNameInThisContext.
Btw correctAgainst: calls correctAgainst:continuedFrom: lineNumberCorrespondingToIndex: is also for compiler warnings. Basically the compiler detects at which index the compiler warning was triggered, the index being the index of the character when you see a string as a collection of characters that triggered the error. this method returns the line where the error was triggered. It is used on the jenkins console to display 'error at line 10 in method Class>>xxx'. expandMacros I am not sure but it seems that it is used by the refactoring browser to encode some data in a string (for ex it seems that <N means chariot return (cr) while refactoring.
For tabDelimitedFieldsDo: you have this example: 'fred charlie elmo 2' tabDelimitedFieldsDo: [:aField | Transcript cr; show: aField]
So basically it executes the block for each substring, the substring being separated by tabs. It would be the same if you split the string on each tab, then you get a collection, and iterate over it with a do: and the block as argument.
I guess this was a way to encode several strings in one string back in the old time but right now it is not used any more. And well #indexOfWideCharacterFrom: start to: end ... The comment is quite explicit.
"Return the index of the first wide character following anIndex" In a String you can have a regular character (there are 256, evaluate 'Character allCharacters' in a workspace). This code detects the first wide character after the index, the index being the character at a specific position when you consider the string as a collection of characters. This is used for Fonts mostly.
hope this could help ! Please if you succeed in implementing your tests don't forget to contribute them back to the community we will be glad to integrate them in the Pharo 3/Pharo 4 release. If you don't know how to contribute to pharo just ask.
2014-02-17 21:04 GMT+01:00 Daniela Meneses <[hidden email]>:
|
In reply to this post by Daniela Meneses
Thanks for your help, this was exactly what I needed to keep going.
Ohh yeap, I'm looking forward to integrate the test I've been working on to Pharo when I finish.
|
Free forum by Nabble | Edit this page |