mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-19061 Integrate the Rearranger-plugin into core-IDEA
More tests have been refactored and enabled
This commit is contained in:
@@ -959,26 +959,13 @@ class RearrangerTest extends LightCodeInsightFixtureTestCase {
|
||||
'arguments number' ( from: 1)
|
||||
} } }
|
||||
|
||||
// public final void testGeneratedComment() throws Exception {
|
||||
// configureByFile("/com/wrq/rearranger/RearrangementTest44.java");
|
||||
// final PsiFile file = getFile();
|
||||
// final Document doc = PsiDocumentManager.getInstance(getProject()).getDocument(file);
|
||||
// final RearrangerActionHandler rah = new RearrangerActionHandler();
|
||||
// CommentRule cr = new CommentRule();
|
||||
// CommentFillString cfs = cr.getCommentFillString();
|
||||
// cfs.setFillString("-+");
|
||||
// cfs.setUseProjectWidthForFill(false);
|
||||
// cfs.setFillWidth(30);
|
||||
// cr.setEmitCondition(CommentRule.EMIT_ALWAYS);
|
||||
// cr.setCommentText("// %FS% METHODS %FS%");
|
||||
// rs.addItem(cr, 0);
|
||||
// MethodAttributes ma;
|
||||
// ma = new MethodAttributes(); // match all methods
|
||||
// rs.addItem(ma, 1);
|
||||
// rah.rearrangeDocument(getProject(), file, rs, doc);
|
||||
// super.checkResultByFile("/com/wrq/rearranger/RearrangementResult44.java");
|
||||
// }
|
||||
//
|
||||
public final void testGeneratedComment() throws Exception {
|
||||
doTest('RearrangementTest44', 'RearrangementResult44') {
|
||||
commentRule.comment('// %FS% METHODS %FS%', condition: CommentRule.EMIT_ALWAYS, 'fill string': '-+',
|
||||
'use project width for fill': false, 'fill width': 30)
|
||||
methodRule.create { } // match all methods
|
||||
} }
|
||||
|
||||
// public void testEnum1() throws Exception {
|
||||
// final Project project = getProject();
|
||||
// final LanguageLevelProjectExtension llpExtension = LanguageLevelProjectExtension.getInstance(project);
|
||||
|
||||
@@ -13,11 +13,18 @@ class CommentRuleBuilder extends AbstractRuleBuilder<CommentRule> {
|
||||
{
|
||||
registerHandler(RearrangerTestDsl.COMMENT, { data, attributes, rule ->
|
||||
rule.commentText = data
|
||||
RearrangerTestUtil.setIf(RearrangerTestDsl.CONDITION, attributes, 'emitCondition', rule)
|
||||
RearrangerTestUtil.setIf(RearrangerTestDsl.ALL_SUBSEQUENT, attributes, 'allSubsequentRules', rule)
|
||||
RearrangerTestUtil.setIf(RearrangerTestDsl.ALL_PRECEDING, attributes, 'allPrecedingRules', rule)
|
||||
RearrangerTestUtil.setIf(RearrangerTestDsl.SUBSEQUENT_RULES_TO_MATCH, attributes, 'NSubsequentRulesToMatch', rule)
|
||||
RearrangerTestUtil.setIf(RearrangerTestDsl.PRECEDING_RULES_TO_MATCH, attributes, 'NPrecedingRulesToMatch', rule)
|
||||
RearrangerTestUtil.setIf(RearrangerTestDsl.CONDITION, attributes, 'emitCondition', rule)
|
||||
RearrangerTestUtil.setIf(RearrangerTestDsl.ALL_SUBSEQUENT, attributes, 'allSubsequentRules', rule)
|
||||
RearrangerTestUtil.setIf(RearrangerTestDsl.ALL_PRECEDING, attributes, 'allPrecedingRules', rule)
|
||||
RearrangerTestUtil.setIf(RearrangerTestDsl.SUBSEQUENT_RULES_TO_MATCH, attributes, 'NSubsequentRulesToMatch', rule)
|
||||
RearrangerTestUtil.setIf(RearrangerTestDsl.PRECEDING_RULES_TO_MATCH, attributes, 'NPrecedingRulesToMatch', rule)
|
||||
|
||||
def fillString = rule.commentFillString
|
||||
RearrangerTestUtil.setIf(RearrangerTestDsl.USE_PROJECT_WIDTH_FOR_COMMENT_FILL, attributes, 'useProjectWidthForFill', fillString)
|
||||
RearrangerTestUtil.setIf(RearrangerTestDsl.FILL_WIDTH, attributes, 'fillWidth', fillString)
|
||||
if (attributes[RearrangerTestDsl.FILL_STRING.value]) {
|
||||
rule.commentFillString.fillString = attributes[RearrangerTestDsl.FILL_STRING.value]
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,10 @@ public enum RearrangerTestDsl {
|
||||
CLASS_COMMENT("class comment"),
|
||||
ARGUMENTS_NUMBER("arguments number"),
|
||||
FROM,
|
||||
TO;
|
||||
TO,
|
||||
FILL_STRING("fill string"),
|
||||
USE_PROJECT_WIDTH_FOR_COMMENT_FILL("use project width for fill"),
|
||||
FILL_WIDTH("fill width");
|
||||
|
||||
@NotNull private final String myValue;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** test generated comment with fill. */
|
||||
public class RearrangementTest44 {
|
||||
// -+-+-+-+- METHODS -+-+-+-+-
|
||||
// -+-+-+-+- METHODS -+-+-+-+-
|
||||
private void method(int i) {
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user