Test on Consecutive Statements
Another exciting milestone reached this week. Back in September, the first issue that got brought up about the mentor tests was that there used to be no way to get information about tests that inquired about more than one node. What's more, there used to not even be a way to write tests that inquired about more than one node in the old Code Test system.
This week saw a huge step forward in making that possible. The Code Tests now contain a crawler called a "ConsecutiveExpressionStatementCrawler" (it occurred to me this week that eventually these names will all need to change and be more user-friendly, but for now I'm sticking with the verbosely descriptive names). With this new crawler type, users can write tests that check whether a consecutive block of expression statements pass some property. The example I often think about with this crawler is the code that contains multiple identical method invocations in a row (which should really be one method invocation inside a Count loop.)
To write tests for a ConsecutiveExpressionStatementCrawler, I decided to change the style of "isValidConstruct"'s method signature. Formerly, it had always been in the format:
def isValidConstruct( construct )
where the user would write a test to determine if the passed-in construct was valid or not. For ConsecutiveExpressionStatementCrawlers, the method signature is now:
def isValidConstruct( firstES, secondES )
where the user writes a test comparing the first ExpressionStatement to the second ExpressionStatement. If it passes, the code begins constructing an ArrayList of all the ExpressionStatements that have passed the isValidConstruct test until it returns false. This means that if there are three ExpressionStatements in a row that all pass, it will return one list of all 3, instead of two lists of 2 (i.e. A and B, and B and C).