1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Tightened a test case and fixed an uncovered bug.

This commit is contained in:
Sergey Prigogin 2011-09-26 20:02:35 -07:00
parent 14939e4ab6
commit f73fa36c10
2 changed files with 7 additions and 3 deletions

View file

@ -918,8 +918,10 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
*/ */
@Override @Override
public int visit(IASTStatement node) { public int visit(IASTStatement node) {
if (startsWithMacroExpansion(node)) if (scribe.scanner.getCurrentPosition() <= node.getFileLocation().getNodeOffset() &&
startsWithMacroExpansion(node)) {
scribe.printCommentPreservingNewLines(); scribe.printCommentPreservingNewLines();
}
if (!startNode(node)) { return PROCESS_SKIP; } if (!startNode(node)) { return PROCESS_SKIP; }
int indentLevel= scribe.indentationLevel; int indentLevel= scribe.indentationLevel;
try { try {

View file

@ -2472,8 +2472,10 @@ public class CodeFormatterTest extends BaseUITestCase {
//#define MY_MACRO switch (0) case 0: default: if (bool x = false) ; else GetStream() //#define MY_MACRO switch (0) case 0: default: if (bool x = false) ; else GetStream()
// //
//void test() { //void test() {
//MY_MACRO << "Loooooooooooooooooooong string literal" << " another literal."; //MY_MACRO
//MY_MACRO << "Looooooooooooooooooooong string literal" << " another literal."; //<< "Loooooooooooooooooooong string literal" << " another literal.";
//MY_MACRO
//<< "Looooooooooooooooooooong string literal" << " another literal.";
//} //}
//struct Stream { //struct Stream {