Added test case for Python backticks.

This commit is contained in:
Maikel Steneker 2018-06-15 11:22:59 +02:00
parent 42f40ddd0e
commit a5b12a4e83

View File

@ -53,4 +53,16 @@ public class PythonTokenizerTest extends AbstractTokenizerTest {
TokenEntry.getEOF();
assertEquals(3, tokens.size()); // 3 tokens: "import" + "logging" + EOF
}
@Test
public void testBackticks() throws IOException {
SourceCode sourceCode = new SourceCode(new SourceCode.StringCodeLoader("test = 'hello'" + PMD.EOL
+ "quoted = `test`" + PMD.EOL
+ "print quoted" + PMD.EOL
));
Tokens tokens = new Tokens();
tokenizer.tokenize(sourceCode, tokens); // should not result in parse error
TokenEntry.getEOF();
assertEquals(3, tokens.getTokens().get(tokens.getTokens().size() - 2).getBeginLine());
}
}