Unnamed: 0
int64 0
305k
| body
stringlengths 7
52.9k
| name
stringlengths 1
185
|
|---|---|---|
291,900
|
void () { doTest("class $X$ { $Content$ }"); }
|
testClassContent
|
291,901
|
void () { doTest("try { $st$; }"); }
|
testNakedTry
|
291,902
|
void () { doTest("BigDecimal"); }
|
testSymbol
|
291,903
|
void () { doTest("@SuppressWarnings"); }
|
testAnnotation
|
291,904
|
void () { doTest("List<String>"); }
|
testType
|
291,905
|
void () { doTest("java.math.BigDecimal<error descr=\"Unexpected token\">)</error>"); }
|
testUnexpectedToken
|
291,906
|
void (@NotNull String code) { doTest(code, ""); }
|
doTest
|
291,907
|
void (@NotNull String code, String contextId) { final JavaCodeFragment fragment = JavaCodeFragmentFactory.getInstance(getProject()).createCodeBlockCodeFragment(code, null, true); myFixture.configureFromExistingVirtualFile(fragment.getVirtualFile()); final Editor editor = myFixture.getEditor(); final Document document = editor.getDocument(); document.putUserData(StructuralSearchDialogKeys.STRUCTURAL_SEARCH_PATTERN_CONTEXT_ID, contextId); myFixture.testHighlighting(false, false, false); }
|
doTest
|
291,908
|
void () { doTest("$<caret>$", ""); }
|
testRemoveDollar
|
291,909
|
void () { doTest("fistfullof$<caret>", "fistfullof<caret>"); }
|
testDollarAtEnd
|
291,910
|
void () { doTest("$hello$<caret>$", "$hello<caret>$"); }
|
testOddDollar
|
291,911
|
void (@NotNull String before, @NotNull String after) { myFixture.configureByText(FileTypes.PLAIN_TEXT, before); final Editor editor = myFixture.getEditor(); editor.putUserData(SubstitutionShortInfoHandler.CURRENT_CONFIGURATION_KEY, new SearchConfiguration()); myFixture.type("\b"); myFixture.checkResult(after); }
|
doTest
|
291,912
|
void () { doTest(HtmlFileType.INSTANCE, "<html><head><title>Hello <caret>Wrold</title></head></html>"); }
|
testDetectHtml
|
291,913
|
void () { doTest(XmlFileType.INSTANCE, "<html><head><title>Hello <caret>Wrold</title></head></html>"); }
|
testDetectXml
|
291,914
|
void () { doTest(JavaFileType.INSTANCE, "class X {{ System.out.println<caret>();}}"); }
|
testDetectJava
|
291,915
|
void (LanguageFileType fileType, String text) { doTest(fileType, text, null); }
|
doTest
|
291,916
|
void (LanguageFileType fileType, String text, String ext) { if (ext == null) ext = fileType.getDefaultExtension(); configureFromFileText("test." + ext, text, true); final SearchContext context = new SearchContext(getProject(), getFile(), getEditor()); assertEquals(fileType, UIUtil.detectFileType(context)); }
|
doTest
|
291,917
|
void () { doTest("<caret>aaa\nbbb\n\n", "$<caret>$aaa\nbbb\n\n"); }
|
testNoSelection
|
291,918
|
void () { doTest("$X<caret>$", "$X$<caret>"); }
|
testTypeOver
|
291,919
|
void () { doTest("$c<caret>$ <caret> ", "$c$<caret> $<caret>$ "); }
|
testMultipleCarets
|
291,920
|
void () { doTest("<selection>bla<caret></selection> no class", "$<selection>bla<caret></selection>$ no class"); }
|
testSurroundSelection
|
291,921
|
void () { doTest("$x<caret>$ y<caret>z <selection>abc<caret></selection>", "$x$<caret> y$<caret>$z $<selection>abc<caret></selection>$"); }
|
testCombined
|
291,922
|
void () { doTest("asdf<caret>$asdf", "asdf$<caret>$asdf"); }
|
testOneDollar
|
291,923
|
void () { doTest("<caret>ba$", "$<caret>ba$"); }
|
testOddDollar1
|
291,924
|
void () { doTest("$ietske<caret>", "$ietske$<caret>"); }
|
testOddDollar2
|
291,925
|
void () { doTest("\t\t<caret>", "\t\t$<caret>$"); }
|
testTabs
|
291,926
|
void (@NotNull String before, @NotNull String after) { myFixture.configureByText(FileTypes.PLAIN_TEXT, before); final Editor editor = myFixture.getEditor(); editor.putUserData(SubstitutionShortInfoHandler.CURRENT_CONFIGURATION_KEY, new SearchConfiguration()); myFixture.type("$"); myFixture.checkResult(after); }
|
doTest
|
291,927
|
void () { doTest("File.createTempFile($p1$, $p2$)", "Forbid File.createTempFile"); }
|
testExpressionStatement
|
291,928
|
void () { doTest(""" $field$ = $something$; if ($field$ == null) { throw new $Exception$($msg$); }""", "silly null check"); }
|
testTwoStatementPattern
|
291,929
|
void () { // check broken pattern does not throw exceptions doTest("int i(", "semicolon expected"); }
|
testBrokenPattern
|
291,930
|
void () { doTest("@'Anno:[regex( Nullable|NotNull )] '_Type:[regex( .*(\\[\\])+ )] '_x;", "report annotation only once"); }
|
testAnnotation
|
291,931
|
void () { doTest("class '_ { \n '_ReturnType 'Method+:* ('_ParameterType '_Parameter*);\n}", "all methods of the class within hierarchy"); }
|
testElementOutsideOfFile
|
291,932
|
void () { doTest("int i;", "int declaration"); }
|
testDeclaration
|
291,933
|
void () { doTest("f();", "method call"); }
|
testMethodCall
|
291,934
|
void () { doTest("System.out.println();", "stdout", "System.out.println(\"Hello World!\");"); }
|
testQuickFix
|
291,935
|
void () { final StringBuilder source = new StringBuilder(""" public class ChainedMethodCallsPerformance { void x() { new StringBuilder() """); for (int i = 0; i < 400; i++) { source.append(" .append(").append(i).append(")\n"); } source.append(" }\n" + "}"); myFixture.configureByText("ChainedMethodCallsPerformance.java", source.toString()); final SearchConfiguration configuration = new SearchConfiguration("Chained method call", "test"); final MatchOptions options = configuration.getMatchOptions(); options.setFileType(JavaFileType.INSTANCE); options.fillSearchCriteria("'_x.'y('_z)"); options.setRecursiveSearch(true); StructuralSearchProfileActionProvider.createNewInspection(configuration, myFixture.getProject()); final InspectionProfileImpl profile = InspectionProfileManager.getInstance(myFixture.getProject()).getCurrentProfile(); final ToolsImpl tools = profile.getToolsOrNull("SSBasedInspection", myFixture.getProject()); final SSBasedInspection inspection = (SSBasedInspection)tools.getTool().getTool(); final PsiFile file = myFixture.getFile(); PlatformTestUtil.startPerformanceTest("Chained method call inspection performance", 1500, () -> InspectionEngine.inspectEx( Collections.singletonList(new LocalInspectionToolWrapper(inspection)), file, file.getTextRange(), file.getTextRange(), true, false, true, new DaemonProgressIndicator(), PairProcessor.alwaysTrue())).assertTiming(); }
|
testChainedMethodCallsPerformance
|
291,936
|
void (String pattern, String name) { doTest(JavaFileType.INSTANCE, pattern, name); }
|
doTest
|
291,937
|
void (String pattern, String name, String replacement) { doTest(JavaFileType.INSTANCE, pattern, name, replacement); }
|
doTest
|
291,938
|
String () { return PlatformTestUtil.getCommunityPath() + "/platform/structuralsearch/testData/ssBased"; }
|
getTestDataPath
|
291,939
|
String () { return ".java"; }
|
getExtension
|
291,940
|
void (JavaFileType fileType, String searchPattern, String patternName) { doTest(fileType, searchPattern, patternName, null); }
|
doTest
|
291,941
|
void (JavaFileType fileType, String search, String name, String replacement) { final Configuration configuration = replacement == null ? new SearchConfiguration() : new ReplaceConfiguration(); configuration.setName(name); final MatchOptions matchOptions = configuration.getMatchOptions(); matchOptions.setFileType(fileType); matchOptions.fillSearchCriteria(search); if (replacement != null) { configuration.getReplaceOptions().setReplacement(replacement); } StructuralSearchProfileActionProvider.createNewInspection(configuration, myFixture.getProject()); myFixture.testHighlighting(true, false, false, getTestName(false) + getExtension()); if (replacement != null) { final IntentionAction intention = myFixture.getAvailableIntention(CommonQuickFixBundle.message("fix.replace.with.x", replacement)); assertNotNull(intention); myFixture.checkPreviewAndLaunchAction(intention); myFixture.checkResultByFile(getTestName(false) + ".after" + getExtension()); } }
|
doTest
|
291,942
|
String (SSBasedInspection inspection) { final Element out = new Element("inspection_tool"); inspection.writeSettings(out); return JDOMUtil.writeElement(out); }
|
writeSettings
|
291,943
|
void () { expectException("' asdf", "Character expected after single quote"); }
|
testCharacterExpectedAfterQuote
|
291,944
|
void () { expectException("'", "Character expected after single quote"); }
|
testCharacterExpectedAfterQuote2
|
291,945
|
void () { expectException("'a{a", "Digit expected"); } public void testDigitExpected2() { expectException("'a{1,a}", "Digit, '}' or ',' expected"); }
|
testDigitExpected
|
291,946
|
void () { expectException("'a{1,a}", "Digit, '}
|
testDigitExpected2
|
291,947
|
void () { test("'_a{3,}'_b{4} '_c{,5}"); final MatchVariableConstraint a = myOptions.getVariableConstraint("a"); assertEquals(3, a.getMinCount()); assertEquals(Integer.MAX_VALUE, a.getMaxCount()); final MatchVariableConstraint b = myOptions.getVariableConstraint("b"); assertEquals(4, b.getMinCount()); assertEquals(4, b.getMaxCount()); final MatchVariableConstraint c = myOptions.getVariableConstraint("c"); assertEquals(0, c.getMinCount()); assertEquals(5, c.getMaxCount()); }
|
testCountedOccurs
|
291,948
|
void () { expectException("'_a{}", "Empty quantifier"); }
|
testEmptyQuantifier1
|
291,949
|
void () { expectException("'_a{,}", "Empty quantifier"); }
|
testEmptyQuantifier2
|
291,950
|
void () { expectException("'a{2147483648}", "Value overflow"); }
|
testOverflow
|
291,951
|
void () { expectException("'a{1,3", "Digit or '}' expected"); }
|
testMissingBrace
|
291,952
|
void () { expectException("'a:", "Constraint expected after ':'"); }
|
testNoOptions
|
291,953
|
void () { test("for('_t 'a : '_b) {}"); assertEquals("for($t$ $a$ : $b$) {}", myOptions.getSearchPattern()); }
|
testColon
|
291,954
|
void () { expectException("'a:+", "Constraint expected after '+'"); }
|
testNoOptions2
|
291,955
|
void () { expectException("'a:[", "']' expected"); }
|
testUnclosedCondition
|
291,956
|
void () { expectException("'a:[]", "Constraint expected after '['"); expectException("'a:[ ]", "Constraint expected after '['"); expectException("'a:[ x]", "' ]' expected"); }
|
testClosedCondition
|
291,957
|
void () { expectException("'a:[!]", "Constraint expected after '!'"); }
|
testEmptyNegated
|
291,958
|
void () { expectException("'a:[aap()]", "Constraint 'aap' not recognized"); }
|
testCondition
|
291,959
|
void () { expectException("'a:[regex(]", "Argument expected on 'regex' constraint"); }
|
testIncompleteCondition
|
291,960
|
void () { expectException("'a:[regex()]", "Argument expected on 'regex' constraint"); }
|
testIncompleteCondition2
|
291,961
|
void () { expectException("'a:[regex( a ) &&]", "Constraint expected after '&&'"); }
|
testIncompleteMultipleCondition
|
291,962
|
void () { try { test("'a:x!("); } catch (MalformedPatternException e) { assertTrue(e.getMessage().startsWith(String.format("Invalid regular expression: Unclosed group near index 3%nx!("))); } }
|
testInvalidRegularExpression
|
291,963
|
void () { expectException("'a*:foo 'a+:[regex( bla )]", "Constraints are only allowed on the first reference of a variable"); }
|
testRepeatingConstraints
|
291,964
|
void () { expectException("'a:foo 'a*", "Constraints are only allowed on the first reference of a variable"); }
|
testRepeatingConstraints2
|
291,965
|
void () { test("'_a::'_b"); assertEquals("$a$::$b$", myOptions.getSearchPattern()); }
|
testMethodReference
|
291,966
|
void () { test("[within( \"if('_a) { 'st*; }\" )]1+1"); assertEquals("1+1", myOptions.getSearchPattern()); final MatchVariableConstraint constraint = myOptions.getVariableConstraint(Configuration.CONTEXT_VAR_NAME); assertEquals("\"if('_a) { 'st*; }\"", constraint.getWithinConstraint()); }
|
testCompleteMatchConditions
|
291,967
|
void () { expectException("'_type 'a:[within( \"if ('_a) { '_st*; }\" )] = '_b;", "Constraint 'within' is only applicable to Complete Match"); }
|
testBadWithin
|
291,968
|
void () { test("[within( \"if ('_a:[regex( .*e.* )]) { '_st*; }\" )]'_type 'a = '_b;"); assertEquals("$type$ $a$ = $b$;", myOptions.getSearchPattern()); final MatchVariableConstraint constraint = myOptions.getVariableConstraint(Configuration.CONTEXT_VAR_NAME); assertEquals("\"if ('_a:[regex( .*e.* )]) { '_st*; }\"", constraint.getWithinConstraint()); test("[!within( \"<'_tag:[regex( ul|ol )] />\" )]<li />"); assertEquals("<li />", myOptions.getSearchPattern()); final MatchVariableConstraint constraint2 = myOptions.getVariableConstraint(Configuration.CONTEXT_VAR_NAME); assertEquals("\"<'_tag:[regex( ul|ol )] />\"", constraint2.getWithinConstraint()); assertTrue(constraint2.isInvertWithinConstraint()); test("[within( \"if ('_a:[regex( \".*\" )]) { '_st*; }\" )]'_type 'a = '_b;"); assertEquals("$type$ $a$ = $b$;", myOptions.getSearchPattern()); final MatchVariableConstraint constraint3 = myOptions.getVariableConstraint(Configuration.CONTEXT_VAR_NAME); assertEquals("\"if ('_a:[regex( \".*\" )]) { '_st*; }\"", constraint3.getWithinConstraint()); }
|
testNestedPatterns
|
291,969
|
void () { test("\\[within( \"if ('_a) { '_st*; }\" )]"); assertEquals("[within( \"if ($a$) { $st$; }\" )]", myOptions.getSearchPattern()); test("\\["); assertEquals("[", myOptions.getSearchPattern()); test("\\'aaa"); assertEquals("'aaa", myOptions.getSearchPattern()); test("'a\\:"); assertEquals("$a$:", myOptions.getSearchPattern()); }
|
testEscaping
|
291,970
|
void () { test("''"); assertEquals("'", myOptions.getSearchPattern()); test("'''c"); assertEquals("'$c$", myOptions.getSearchPattern()); test("'a''b"); assertEquals("'a'$b$", myOptions.getSearchPattern()); test("'aa'_bb"); assertEquals("$aa$$bb$", myOptions.getSearchPattern()); test("'\\n''z"); assertEquals("'\\n'$z$", myOptions.getSearchPattern()); test("'\\u0123''a"); assertEquals("'\\u0123'$a$", myOptions.getSearchPattern()); }
|
testQuotes
|
291,971
|
void () { test("'_t:[regex( *Object\\[\\] ) ] '_t2"); assertEquals("$t$ $t2$", myOptions.getSearchPattern()); final MatchVariableConstraint constraint = myOptions.getVariableConstraint("t"); assertTrue(constraint.isWithinHierarchy()); assertEquals("Object\\[\\]", constraint.getRegExp()); test("// 'Comment:[regex( .*(?:comment).* )]"); assertEquals("// $Comment$", myOptions.getSearchPattern()); final MatchVariableConstraint constraint1 = myOptions.getVariableConstraint("Comment"); assertEquals(".*(?:comment).*", constraint1.getRegExp()); }
|
testComplexRegexes
|
291,972
|
void () { test("'a:[!regexw(a)&&formal(*List)]"); assertEquals("$a$", myOptions.getSearchPattern()); final MatchVariableConstraint constraint = myOptions.getVariableConstraint("a"); assertTrue(constraint.isWholeWordsOnly()); assertEquals("a", constraint.getRegExp()); assertTrue(constraint.isInvertRegExp()); assertTrue(constraint.isFormalArgTypeWithinHierarchy()); assertFalse(constraint.isInvertFormalType()); assertEquals("List", constraint.getNameOfFormalArgType()); }
|
testInvert
|
291,973
|
void () { test("class '_X:!*A {}"); assertEquals("class $X$ {}", myOptions.getSearchPattern()); final MatchVariableConstraint constraint = myOptions.getVariableConstraint("X"); assertTrue(constraint.isInvertRegExp()); assertTrue(constraint.isWithinHierarchy()); assertEquals("A", constraint.getRegExp()); }
|
testInvertShortcut
|
291,974
|
void () { expectException("'a:[regex(a) regex(b)]", "'&&' expected"); }
|
testAmpersandsExpected
|
291,975
|
void () { expectException("'a:[&®ex(a)]", "Unexpected '&'"); }
|
testUnexpectedAmpersands
|
291,976
|
void () { expectException("'a:[regex( .* ) ]", "' )' expected"); }
|
testUnbalancedSpacesSurroundingContent
|
291,977
|
void () { test("'t:[regex(a)]"); final MatchVariableConstraint constraint = myOptions.getVariableConstraint("t"); assertEquals("a", constraint.getRegExp()); }
|
testNoSpacesSurroundingRegexNeeded
|
291,978
|
void () { expectException("try { 'Statements+; } catch('_ '_) { 'HandlerStatements+; }", "Only one target allowed"); }
|
testMultipleTargets
|
291,979
|
void () { test("'a = 'a;"); }
|
testSameTargetMultipleTimes
|
291,980
|
void () { test("a"); assertNotNull(myOptions.getVariableConstraint(Configuration.CONTEXT_VAR_NAME)); }
|
testPresenceOfContext
|
291,981
|
void () { test("'_x:[exprtype( java\\.lang\\.String\\[\\]\\[\\] )]"); final MatchVariableConstraint constraint = myOptions.getVariableConstraint("x"); assertEquals("java\\.lang\\.String\\[\\]\\[\\]", constraint.getNameOfExprType()); }
|
testBrackets
|
291,982
|
void () { test("'_x:[_custom( test )]"); final MatchVariableConstraint x = myOptions.getVariableConstraint("x"); assertEquals("test", x.getAdditionalConstraint("custom")); }
|
testAdditionalConstraint
|
291,983
|
void (@NotNull String criteria, @NotNull String exceptionMessage) { try { test(criteria); } catch (MalformedPatternException e) { assertFalse(e.getMessage(), exceptionMessage.isEmpty()); assertTrue(e.getMessage(), e.getMessage().startsWith(exceptionMessage)); } }
|
expectException
|
291,984
|
void (@NotNull String criteria) { StringToConstraintsTransformer.transformCriteria(criteria, myOptions); }
|
test
|
291,985
|
void () { <warning descr="int declaration">int i;</warning> int j; f(); int k; }
|
f
|
291,986
|
void () { int i; int j; <warning descr="method call">f();</warning> int k; }
|
f
|
291,987
|
void (String[] args) { junit.textui.TestRunner.run(ForecastSummaryReportTest.class); }
|
main
|
291,988
|
void () { try { ForecastSummaryReport testReport = new ForecastSummaryReport(oSkdgrp.getCorporateEntity(), oDateRange); assertNotNull(testReport); } catch (RetailException e) { e.printStackTrace(); fail("RetailException: Could not create ForecastSummaryReport(CorporateEntity, SODateInterval)"); } }
|
testForecastSummaryReport
|
291,989
|
void () { oReport.setIncludeSublocationsFlag(true); assertTrue(oReport.isIncludeSublocationsFlagSet()); }
|
testSetIncludeSublocationsFlag
|
291,990
|
void () { oReport.setIncludeSublocationsFlag(false); assertFalse(oReport.isIncludeSublocationsFlagSet()); oReport.setIncludeSublocationsFlag(true); assertTrue(oReport.isIncludeSublocationsFlagSet()); }
|
testIsIncludeSublocationsFlagSet
|
291,991
|
void () { int field; }
|
aaa
|
291,992
|
void () { int field3; }
|
aaa3
|
291,993
|
void (String[] args) { junit.textui.TestRunner.run(ForecastSummaryReportTest.class); }
|
main
|
291,994
|
void () { }
|
testGenerate
|
291,995
|
void () { try { ForecastSummaryReport testReport = new ForecastSummaryReport(oSkdgrp.getCorporateEntity(),oDateRange); assertNotNull(testReport); } catch (RetailException e) { e.printStackTrace(); fail("RetailException: Could not create ForecastSummaryReport(CorporateEntity, SODateInterval)"); } }
|
testForecastSummaryReport
|
291,996
|
void () { oReport.setIncludeSublocationsFlag(true); assertTrue(oReport.isIncludeSublocationsFlagSet()); }
|
testSetIncludeSublocationsFlag
|
291,997
|
void () { oReport.setIncludeSublocationsFlag(false); assertFalse(oReport.isIncludeSublocationsFlagSet()); oReport.setIncludeSublocationsFlag(true); assertTrue(oReport.isIncludeSublocationsFlagSet()); }
|
testIsIncludeSublocationsFlagSet
|
291,998
|
boolean (final VirtualFile vfile) { final PsiFile file = ApplicationManager.getApplication().runReadAction(new Computable<PsiFile>() { public PsiFile compute() { return myManager.findFile(vfile); } }); if (file != null && !(file instanceof PsiBinaryFile)) { file.getViewProvider().getContents(); // load contents outside readaction ApplicationManager.getApplication().runReadAction(new Runnable() { public void run() { try { PsiElement[] psiRoots = file.getPsiRoots(); Set<PsiElement> processed = new HashSet<PsiElement>(psiRoots.length * 2, (float)0.5); for (PsiElement psiRoot : psiRoots) { if (progress != null) progress.checkCanceled(); if (!processed.add(psiRoot)) continue; if (!psiRootProcessor.process(psiRoot)) { canceled.set(true); return; } } myManager.dropResolveCaches(); } catch (ProcessCanceledException e) { canceled.set(true); pceThrown.set(true); } } }); } if (progress != null) { double fraction = (double)counter.incrementAndGet() / size; progress.setFraction(fraction); } return !canceled.get(); }
|
process
|
291,999
|
PsiFile () { return myManager.findFile(vfile); }
|
compute
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.