forked from phoedos/pmd
Added unit tests for block comments.
This commit is contained in:
@@ -68,4 +68,22 @@ public class MatlabTokenizerTest extends AbstractTokenizerTest {
|
||||
TokenEntry.getEOF();
|
||||
assertEquals(28, tokens.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBlockComments() throws IOException {
|
||||
SourceCode sourceCode = new SourceCode(new SourceCode.StringCodeLoader("%{" + PMD.EOL
|
||||
+ " Name: helloworld.m\n" + PMD.EOL
|
||||
+ " Purpose: Say \"Hello World!\" in two different ways" + PMD.EOL
|
||||
+ "%}" + PMD.EOL
|
||||
+ PMD.EOL
|
||||
+ "% Do it the good ol' fashioned way...command window" + PMD.EOL
|
||||
+ "disp('Hello World!');\n" + PMD.EOL
|
||||
+ "%" + PMD.EOL
|
||||
+ "% Do it the new hip GUI way...with a message box" + PMD.EOL
|
||||
+ "msgbox('Hello World!','Hello World!');"));
|
||||
Tokens tokens = new Tokens();
|
||||
tokenizer.tokenize(sourceCode, tokens); // should not result in parse error
|
||||
TokenEntry.getEOF();
|
||||
assertEquals(13, tokens.size());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user