Skip to content

Commit

Permalink
Got rid of duplicated test source samples
Browse files Browse the repository at this point in the history
  • Loading branch information
hurricup committed Apr 30, 2020
1 parent 350b70d commit ca909a1
Show file tree
Hide file tree
Showing 22 changed files with 40 additions and 68 deletions.
10 changes: 10 additions & 0 deletions plugin/test/base/PerlLightTestCaseBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -944,8 +944,18 @@ protected void doTestBackspaceWithoutFiles(@NotNull String initialText, @NotNull
myFixture.checkResult(expected);
}


protected void doTestEnter(@NotNull String fileName) {
initWithFileSmart(fileName);
doTestEnterNoInit();
}

protected void doTestEnter() {
initWithFileSmart();
doTestEnterNoInit();
}

protected void doTestEnterNoInit() {
myFixture.type('\n');
UsefulTestCase.assertSameLinesWithFile(getTestResultsFilePath(), getEditorTextWithCaretsAndSelections());
}
Expand Down
32 changes: 18 additions & 14 deletions plugin/test/formatter/PerlSubsFormatterEnterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,61 +46,61 @@ public void testSignatureElementDefaultValueAfterAssign() {
@Test
public void testSignatureElementDefaultValueSecond() {
getCustomSettings().ALIGN_CONSECUTIVE_ASSIGNMENTS = NO_ALIGN;
doTest();
doTest("signatureElementDefaultValueSecond");
}

@Test
public void testSignatureElementDefaultValueSecondAligned() {
getCustomSettings().ALIGN_CONSECUTIVE_ASSIGNMENTS = ALIGN_LINES;
doTest();
doTest("signatureElementDefaultValueSecond");
}

@Test
public void testSignatureElementDefaultValueSecondAlignedStatement() {
getCustomSettings().ALIGN_CONSECUTIVE_ASSIGNMENTS = ALIGN_IN_STATEMENT;
doTest();
doTest("signatureElementDefaultValueSecond");
}

@Test
public void testSignatureElementDefaultValueMiddle() {
getCustomSettings().ALIGN_CONSECUTIVE_ASSIGNMENTS = NO_ALIGN;
doTest();
doTest("signatureElementDefaultValueMiddle");
}

@Test
public void testSignatureElementDefaultValueMiddleAligned() {
getCustomSettings().ALIGN_CONSECUTIVE_ASSIGNMENTS = ALIGN_LINES;
doTest();
doTest("signatureElementDefaultValueMiddle");
}

@Test
public void testSignatureElementDefaultValueMiddleAlignedStatement() {
getCustomSettings().ALIGN_CONSECUTIVE_ASSIGNMENTS = ALIGN_IN_STATEMENT;
doTest();
doTest("signatureElementDefaultValueMiddle");
}

@Test
public void testAttributeSecond() {
getCustomSettings().ALIGN_ATTRIBUTES = false;
doTest();
doTest("attributeSecond");
}

@Test
public void testAttributeSecondAligned() {
getCustomSettings().ALIGN_ATTRIBUTES = true;
doTest();
doTest("attributeSecond");
}

@Test
public void testAttributeMiddle() {
getCustomSettings().ALIGN_ATTRIBUTES = false;
doTest();
doTest("attributeMiddle");
}

@Test
public void testAttributeMiddleAligned() {
getCustomSettings().ALIGN_ATTRIBUTES = true;
doTest();
doTest("attributeMiddle");
}

@Test
Expand All @@ -121,25 +121,25 @@ public void testSignatureAfterCommaMiddle() {
@Test
public void testSignatureAfterCommaContinuation() {
getSettings().ALIGN_MULTILINE_PARAMETERS = false;
doTest();
doTest("signatureAfterCommaContinuation");
}

@Test
public void testSignatureAfterCommaContinuationAligned() {
getSettings().ALIGN_MULTILINE_PARAMETERS = true;
doTest();
doTest("signatureAfterCommaContinuation");
}

@Test
public void testSignatureAfterCommaContinuationMiddle() {
getSettings().ALIGN_MULTILINE_PARAMETERS = false;
doTest();
doTest("signatureAfterCommaContinuationMiddle");
}

@Test
public void testSignatureAfterCommaContinuationMiddleAligned() {
getSettings().ALIGN_MULTILINE_PARAMETERS = true;
doTest();
doTest("signatureAfterCommaContinuationMiddle");
}

@NotNull
Expand All @@ -160,6 +160,10 @@ protected void doTest() {
doTestEnter();
}

protected void doTest(@NotNull String fileName) {
doTestEnter(fileName);
}

public static class After extends PerlSubsFormatterEnterTest {
@NotNull
@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
after somemethod( $var,
<caret>
$othervar
$othervar
) {
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
around somemethod( $var,
<caret>
$othervar
$othervar
) {
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
augment somemethod( $var,
<caret>
$othervar
$othervar
) {
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
before somemethod( $var,
<caret>
$othervar
$othervar
) {
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fun somefun( $var,
<caret>
$othervar
$othervar
) {
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fun( $var,
<caret>
$othervar
$othervar
) {
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
func somefunc( $var,
<caret>
$othervar
$othervar
) {
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
method somemethod( $var,
<caret>
$othervar
$othervar
) {
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
method( $var,
<caret>
$othervar
$othervar
) {
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
override somemethod( $var,
<caret>
$othervar
$othervar
) {
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sub somesub( $var,
<caret>
$othervar
$othervar
) {
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sub( $var,
<caret>
$othervar
$othervar
) {
};

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit ca909a1

Please sign in to comment.