Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
28,500
void () { for (Map.Entry<String, String> entry : Map.of( "noArg()", "java.util.List", "singleArg(1)", "java.lang.Integer", "singleArg(\"\")", "java.lang.String", "singleArg(new Object())", "java.lang.Object", "doubleArgs([1,2,3], {})", "java.util.List<java.lang.Integer>", "doubleArgs([] as Number[], {})", "java.util.List<java.lang.Number>", "varArgs(1,2,3)", "java.util.List<java.lang.Integer>", "varArgs(1,2l,3d)", "java.util.List<java.lang.Number>", "varArgs(1,2l,3d, new Object())", "java.util.List<java.lang.Object>" ).entrySet()) { String innerCallText = entry.getKey(); String returnType = entry.getValue(); for (String callText : List.of( "doubleArgs([1,2,3], {<caret>" + innerCallText + "})", "doubleArgs([] as Number[], {<caret>" + innerCallText + "})")) { for (String text : List.of( "builder.root {" + callText + "}", "builder.root([a:1]) {" + callText + "}", "builder.root({" + callText + "}, a:1)")) { getFixture().configureByText("a.groovy", "def builder = new groovy.json.JsonBuilder(); " + text); var reference = (GrReferenceExpression)getFixture().getReferenceAtCaretPosition(); assert reference.resolve() instanceof PsiMethod; assert reference.getType().getCanonicalText().equals(returnType); } } } }
testBuilderDelegateInnerCallsResolveAndReturnType
28,501
void (String codeBefore, String expectedCodeAfter) { myFixture.configureByText("A.groovy", codeBefore); new UnwrapHandler().invoke(getProject(), myFixture.getEditor(), myFixture.getFile()); myFixture.checkResult(expectedCodeAfter); }
assertUnwrapped
28,502
void () { assertUnwrapped(""" if (true) { a=1; c = 3 b=1;<caret> } """, """ a=1; c = 3 b=1;"""); }
testUnwrapIf
28,503
void () { assertUnwrapped(""" for(int i = 0; i < 10; i++) { Sys<caret>tem.gc(); } """, "Sys<caret>tem.gc();"); }
testUnwrapFor1
28,504
void () { assertUnwrapped("xxx(1, yyy(<caret>1), 2)", "xxx(1, <caret>1, 2)"); }
testUnwrapParameterUnderArgumentList
28,505
void () { assertUnwrapped(""" try { int i;<caret> } catch(RuntimeException e) { int j; } catch(Exception e) { int k; }""", "int i;"); }
testTryWithCatches
28,506
void () { assertUnwrapped("xxx(f ? <caret>'1' : '2');\n", "xxx('1');\n"); }
testConditionalThat
28,507
void () { assertUnwrapped("xxx(f ? '1' : '2' +<caret> 3);\n", "xxx('2' +<caret> 3);\n"); }
testConditionalElse
28,508
void () { assertUnwrapped("xxx(11, f ? '1' : '2' +<caret> 3, 12);\n", "xxx(11, '2' +<caret> 3, 12);\n"); }
testConditionalFromParameterList2
28,509
void () { assertUnwrapped("f <caret>? \"1\" : \"2\" + 3", "\"1\""); }
testConditionalCond1
28,510
void () { assertUnwrapped("<caret>f ? \"1\" : \"2\" + 3", "\"1\""); }
testConditionalCond2
28,511
void () { assertUnwrapped("String s = f ? \"1<caret>\" : \"2\";\n", "String s = \"1\";\n"); }
testConditionalUnwrapUnderAssigmentExpression
28,512
String () { return TestUtils.getTestDataPath() + "lineMarker/"; }
getBasePath
28,513
void () { doSimpleTest(3);}
testInterface
28,514
void () { doSimpleTest(3);}
testGStringMethodName
28,515
void () { doSimpleTest(3);}
testStringMethodName
28,516
void () { doSimpleTest(3);}
testAllGStringMethodName
28,517
void () { myFixture.configureByFiles(getTestName(false)+".groovy", getTestName(false)+".java"); doTest(1); }
testJavaToGroovy
28,518
void () { myFixture.configureByFiles(getTestName(false)+".groovy", getTestName(false)+".java"); doTest(2); }
testGroovyToJava
28,519
void () { myFixture.configureByFiles("JavaToGroovy.java", "JavaToGroovy.groovy"); doTest(2); }
testJavaToGroovy2
28,520
void () { myFixture.configureByFiles("GroovyToJava.java", "GroovyToJava.groovy"); doTest(1); }
testGroovyToJava2
28,521
void (int count) { myFixture.configureByFile(getTestName(false)+".groovy"); doTest(count); }
doSimpleTest
28,522
void (int count) { final Editor editor = myFixture.getEditor(); final Project project = myFixture.getProject(); myFixture.doHighlighting(); final List<LineMarkerInfo<?>> infoList = DaemonCodeAnalyzerImpl.getLineMarkers(editor.getDocument(), project); assertEquals(count, infoList.size()); }
doTest
28,523
String () { return TestUtils.getTestDataPath() + "groovy/gotoSuper/"; }
getBasePath
28,524
void () { doTest(); }
testGts1
28,525
void () { doTest(); }
testGts2
28,526
void () { doTest(); }
testGts3
28,527
void () { final List<String> data = TestUtils.readInput(getTestDataPath() + getTestName(true) + ".test"); myFixture.configureByText(GroovyFileType.GROOVY_FILE_TYPE, data.get(0)); final CodeInsightActionHandler handler = CodeInsightActions.GOTO_SUPER.forLanguage(GroovyLanguage.INSTANCE); handler.invoke(getProject(), myFixture.getEditor(), myFixture.getFile()); myFixture.checkResult(data.get(1)); }
doTest
28,528
String () { return TestUtils.getTestDataPath()+"resolve/label"; }
getBasePath
28,529
void () { final PsiReference ref = configureByFile(getTestName(true)+"/"+getTestName(false) + ".groovy"); final PsiElement resolved = ref.resolve(); assertNotNull(resolved); assertInstanceOf(resolved, GrLabeledStatement.class); }
testLabelResolve
28,530
void () { final PsiReference ref = configureByFile(getTestName(true)+"/"+getTestName(false) + ".groovy"); final PsiElement resolved = ref.resolve(); assertNotNull(resolved); assertInstanceOf(resolved, GrLabeledStatement.class); }
testLabelResolve2
28,531
void () { final PsiReference ref = configureByFile(getTestName(true)+"/"+getTestName(false) + ".groovy"); final PsiElement resolved = ref.resolve(); assertNull(resolved); }
testLabelNotResolved
28,532
void () { doTest(); }
testManyOverridingMethods
28,533
void () { doTest(); }
testManyOverrMethods2
28,534
void () { doTest(); }
testManyOverrMethods3
28,535
void () { doTest(); }
testManyOverrMethods4
28,536
void () { doTest(); }
testOverrideClassMethod
28,537
void () { doTest(); }
testOverrideInterfaceMethod
28,538
String () { return super.getBasePath() + "deepestSuperMethods"; }
getBasePath
28,539
String () { return super.getBasePath() + "allSuperMethods"; }
getBasePath
28,540
void () { doTest(); }
testExtendsAndImplements
28,541
void () { doTest(); }
testExtendsClass
28,542
void () { doTest(); }
testImplementsImplements
28,543
void () { doTest(); }
testImplementsInterface
28,544
void () { doTest(); }
testManyOverrMethods2
28,545
void () { doTest(); }
testManySuperMethods
28,546
void () { doTest(); }
testMethodWithoutParameters
28,547
void () { doTest(); }
testMethodWithParameters
28,548
String () { return TestUtils.getTestDataPath() + "overriding/"; }
getBasePath
28,549
void () { final String testFile = getTestName(true) + ".test"; final List<String> strings = TestUtils.readInput(getTestDataPath() + "/" + testFile); GroovyFileBase psiFile = (GroovyFileBase) myFixture.addFileToProject("foo.groovy", strings.get(0)); StringBuilder buffer = new StringBuilder(); GrTypeDefinition[] grTypeDefinitions = psiFile.getTypeDefinitions(); GrTypeDefinition lastTypeDefinition = psiFile.getTypeDefinitions()[grTypeDefinitions.length - 1]; PsiMethod[] psiMethods = lastTypeDefinition.getMethods(); for (PsiMethod method : psiMethods) { PsiMethod[] superMethods = findMethod(method); String[] classes = sortUseContainingClass(superMethods); for (String classAsString : classes) { buffer.append(classAsString); buffer.append("\n"); //between different super methods } buffer.append("\n"); //between different methods } buffer.append("\n"); //between class definitions assertEquals(strings.get(1), buffer.toString().trim()); }
doTest
28,550
String[] (PsiMethod[] psiMethods) { String[] classes = new String[psiMethods.length]; for (int i = 0; i < psiMethods.length; i++) { PsiMethod psiMethod = psiMethods[i]; classes[i] = psiMethod.getContainingClass().toString() + ": " + psiMethod.getContainingClass().getName() + "; " + psiMethod.getHierarchicalMethodSignature().toString(); } Arrays.sort(classes); return classes; }
sortUseContainingClass
28,551
String () { return TestUtils.getTestDataPath() + "groovy/actions/moveStatement/"; }
getBasePath
28,552
void () { bothTest(); }
testClazz2
28,553
void () { bothTest(); }
testClos2
28,554
void () { bothTest(); }
testMeth1
28,555
void () { final List<String> data = TestUtils.readInput(getTestDataPath() + getTestName(true) + ".test"); myFixture.configureByText(GroovyFileType.GROOVY_FILE_TYPE, data.get(0)); performAction(IdeActions.ACTION_MOVE_STATEMENT_DOWN_ACTION); myFixture.checkResult(data.get(1)); }
testMeth2
28,556
void () { bothTest(); }
testMeth3
28,557
void () { bothTest(); }
testMeth4
28,558
void () { bothTest(); }
testIfst
28,559
void () { bothTest(); }
testIfst2
28,560
void () { bothTest(); }
testSimple1
28,561
void () { bothTest(); }
testSimple2
28,562
void () { bothTest(); }
testTryst1
28,563
void () { bothTest(); }
testTryst2
28,564
void () { bothTest(); }
testStatementOutsideClosure
28,565
void () { bothTest(); }
testVariableOutsideClosure
28,566
void () { bothTest(); }
testVariableOutsideClosureDown
28,567
void () { bothTest(); }
testStatementInsideClosure
28,568
void () { bothTest(); }
testMoveGroovydocWithMethod
28,569
void () { bothTest(); }
testLeaveGroovydocWithMethod
28,570
void () { bothTest(); }
testMoveMethodWithGroovydoc
28,571
void () { bothTest(); }
testMoveGroovyDocWithField
28,572
void () { bothTest(); }
testMoveSecondFieldUp
28,573
void () { bothTest(); }
testMoveFirstFieldDown
28,574
void () { bothTest(); }
testVariableOverMethodInScript
28,575
void () { bothTest(); }
testVariableOverClassInScript
28,576
void () { bothTest(); }
testUpFromLastOffset
28,577
void () { bothTest(); }
testClosureWithPrequel
28,578
void () { bothTest(); }
testMultiLineVariable
28,579
void () { bothTest(); }
testClosureVariableByRBrace
28,580
void () { bothTest(); }
testInsideMultilineString
28,581
void () { bothTest(); }
testAroundMultilineString
28,582
void () { bothTest(); }
testAroundMultilineString2
28,583
void () { bothTest(); }
testInSwitchCaseUp1
28,584
void () { bothTest(); }
testInSwitchCaseUp2
28,585
void () { bothTest(); }
testInSwitchCaseUp3
28,586
void () { bothTest(); }
testInSwitchCaseUp4
28,587
void () { bothTest(); }
testInSwitchCaseUp5
28,588
void () { bothTest(); }
testInSwitchExprUp1
28,589
void () { bothTest(); }
testTwoStatements
28,590
void () { bothTest(); }
testStatementToEmptySpace
28,591
void () { bothTest(); }
testStatementToEmptySpace2
28,592
void () { bothTest(); }
testStatementToEmptySpace3
28,593
void () { bothTest(); }
testStatementsWithSemicolons
28,594
void () { bothTest(); }
testStatementsWithComments
28,595
void () { bothTest(); }
testMoveIntoEmptyLine
28,596
void () { bothTest(); }
testMoveIntoEmptyLine2
28,597
void () { bothTest(); }
testClassesWithFields
28,598
void () { final List<String> data = TestUtils.readInput(getTestDataPath() + getTestName(true) + ".test"); final String initial = data.get(0); final String upper = data.get(1); String lower = data.size() == 2 ? data.get(0) : data.get(2); myFixture.configureByText(GroovyFileType.GROOVY_FILE_TYPE, initial); performAction(IdeActions.ACTION_MOVE_STATEMENT_UP_ACTION); myFixture.checkResult(upper); performAction(IdeActions.ACTION_MOVE_STATEMENT_DOWN_ACTION); if (!lower.endsWith("\n") && myFixture.getEditor().getDocument().getText().endsWith("\n")) lower += "\n"; myFixture.checkResult(lower); }
bothTest
28,599
void () { doTest(); }
testConfig_object