added whitespace checks to assert statement
This commit is contained in:
parent
ba441b3fd6
commit
2a7c9dd831
|
|
@ -53,7 +53,13 @@ assertStatement[int[] aType, MyCommonAST[] aCurlies]
|
|||
final MyCommonAST[] stmtBraces = new MyCommonAST[2];
|
||||
stmtType[0] = STMT_OTHER;
|
||||
}
|
||||
: ASSERT^ expression ( COLON! expression )? SEMI!
|
||||
: asrt:ASSERT^ expression ( c:COLON! expression )? SEMI!
|
||||
{
|
||||
ver.verifyWSAroundBegin(asrt.getLine(), asrt.getColumn(), asrt.getText());
|
||||
if (c != null) {
|
||||
ver.verifyWSAroundBegin(c.getLine(), c.getColumn(), c.getText());
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
class GeneratedJava14Lexer extends GeneratedJavaLexer;
|
||||
|
|
|
|||
|
|
@ -141,6 +141,9 @@ public class CheckerTest
|
|||
filepath + ":129: '.' is followed by whitespace.",
|
||||
filepath + ":136: '.' is preceeded with whitespace.",
|
||||
filepath + ":136: '.' is followed by whitespace.",
|
||||
filepath + ":153: 'assert' is not followed by whitespace.",
|
||||
filepath + ":156: ':' is not preceeded with whitespace.",
|
||||
filepath + ":156: ':' is not followed by whitespace.",
|
||||
};
|
||||
verify(c, filepath, expected);
|
||||
}
|
||||
|
|
@ -202,6 +205,9 @@ public class CheckerTest
|
|||
filepath + ":129: '.' is followed by whitespace.",
|
||||
filepath + ":136: '.' is preceeded with whitespace.",
|
||||
filepath + ":136: '.' is followed by whitespace.",
|
||||
filepath + ":153: 'assert' is not followed by whitespace.",
|
||||
filepath + ":156: ':' is not preceeded with whitespace.",
|
||||
filepath + ":156: ':' is not followed by whitespace.",
|
||||
};
|
||||
verify(c, filepath, expected);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,12 +149,10 @@ class InputWhitespace
|
|||
// evil colons, should be OK
|
||||
assert "OK".equals(null) ? false : true : "Whups";
|
||||
|
||||
// WS tests for assert not implemented yet
|
||||
|
||||
// missing WS around assert
|
||||
// assert(true);
|
||||
assert(true);
|
||||
|
||||
// missing WS around colon
|
||||
// assert true:"Whups";
|
||||
assert true:"Whups";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue