Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
291,800
void () { String s1 = """ class X {{ class A {} class B extends A { static void foo(); } class B2 extends A { static void foo(int a); } class B3 extends A { static void foo(int a, int b); } class C { static void foo(); } B.foo(); B2.foo(1); B3.foo(2,3); C.foo(); }}"""; assertEquals("Find static methods within expr type...
testFindStaticMethodsWithinHierarchy
291,801
void () { String s1 = """ class A implements I {} interface I {} class B extends A implements I { } class B2 implements I { } class B3 extends A { } class C extends B2 { static void foo(); } """; assertEquals("Find class within type hierarchy with not", 1, findMatchesCount(s1, "class '_ extends '_Extends:[!regex( *A )]...
testFindClassesWithinHierarchy
291,802
void () { String s1 = """ class X {{ try { conn = 1; } finally { conn.close(); } try { conn = 1; } finally { int a = 1; } try { conn = 1; } finally { int a = 1; } }}"""; String s2 = "try { '_StatementBefore*; '_Dcl:[regex( conn = 1 )]; '_StatementAfter*; } finally { '_Finally*:[!regex( .*conn.* ) ]; }"; assertEquals("F...
testFindTryWithoutProperFinally
291,803
void () { String s1 = """ public class DiallingNumber extends DataGroup { protected static byte [] CLEAR = { }; private static DataItemTemplate template; \tprotected DataTemplate createDefaultTemplate() \t{ return null; } }"""; String s2 = """ class '_Class { static '_FieldType '_FieldName:.*template.* = '_FieldInitial...
testBug
291,804
void () { String s1 = """ public class DiallingNumber { static { int a = 1; } static { int b = 1; } { int c = 2; } }"""; assertEquals("Static / instance initializers", 2, findMatchesCount(s1, "static { '_t*; }")); assertEquals("Static / instance initializers", 1, findMatchesCount(s1, "@Modifier(\"Instance\") { '_t*; }"...
testStaticInstanceInitializers
291,805
String () { return PlatformTestUtil.getCommunityPath() + "/platform/structuralsearch/testData/java/"; }
getTestDataPath
291,806
void () { '_t*:[ !regex( .*return.* ) ]; }
run
291,807
void () { String source = """ class X { void x() { y(); } void y() {} void z() { z(); } void a() { a(); } }"""; String pattern = """ void '_a() { '_a(); }"""; assertEquals(2, findMatchesCount(source, pattern)); }
testFindRecursiveCall
291,808
void () { String s1 = """ class A { int bbb(int c, int ddd, int eee) { int a = 1; try { int b = 1; } catch(Type t) { a = 2; } catch(Type2 t2) { a = 3; } } }"""; final List<PsiVariable> vars = new ArrayList<>(); @SuppressWarnings("deprecation") final PsiFile file = PsiFileFactory.getInstance(getProject()).createFileFrom...
testDownUpMatch
291,809
void () { String s1 = """ class X {{ int a; a = 1; } { int b = 1; b = 1; } { int c = 2; c = 2; }}"""; assertEquals(2, findMatchesCount(s1, "{ '_a*:[contains( \"'type '_a = '_b;\" )]; }")); assertEquals(1, findMatchesCount(s1, "{ '_a*:[!contains( \"'_type '_a = '_b;\" )]; }")); }
_testContainsPredicate
291,810
void () { String s1 = """ class X {{ if (true) { int a = 1; } if (true) { int b = 1; } while(true) { int c = 2; } }}"""; String s2 = "[within( \"if ('_a) { '_st*; }\" )]'_type 'a = '_b;"; assertEquals(2,findMatchesCount(s1, s2)); String s2_2 = "[!within( \"if ('_a) { '_st*; }\" )]'_type 'a = '_b;"; assertEquals(1,findM...
testWithinPredicate
291,811
void () { String s3 = """ class C { void aaa() { LOG.debug(1); LOG.debug(2); LOG.debug(3); LOG.debug(4); LOG.debug(5); if (true) { LOG.debug(6); } if (true) LOG.debug(7); if (true) { int L = 1; } else { LOG.debug(8); } if (true) { if (true) {} if (true) {} } else{ LOG.debug(9); } } }"""; String s4 = "[!within( \"if('_a...
testWithinPredicate2
291,812
void () { String s = "class X {{ Integer i; i.valueOf(); }}"; assertEquals(1, findMatchesCount(s, "Integer '_i;\n'_i.valueOf();")); String s_2 = "class X {{ Integer i; int a = 1; i.valueOf(); }}"; assertEquals(1, findMatchesCount(s_2, "Integer '_i;\n'_st; '_i.valueOf();")); String pattern = "Integer '_i;\n'_st*; '_i.va...
testMultiStatementPatternWithTypedVariable
291,813
void () { String s = "interface Foo {} interface Bar {} @interface X {}"; String s2 = "@interface 'x {}"; assertEquals(1, findMatchesCount(s,s2)); }
testFindAnnotationDeclarations
291,814
void () { String s = "class Foo {} class Bar {} enum X {}"; assertEquals(1, findMatchesCount(s, "enum 'x {}")); String in = """ enum E { A(1), B(2), C(3) }"""; assertEquals(1, findMatchesCount(in, "enum '_E { 'A(2) }")); assertEquals(0, findMatchesCount(in, "enum '_E { 'A('_x{0,0}) }")); assertEquals(0, findMatchesCoun...
testFindEnums
291,815
void () { String in = """ public class F { static Category cat = Category.getInstance(F.class.getName()); Category cat2 = Category.getInstance(F.class.getName()); Category cat3 = Category.getInstance(F.class.getName()); }"""; String pattern = "static '_Category '_cat = '_Category.getInstance('_Arg);"; assertEquals(1, f...
testFindDeclaration
291,816
void () { String source = "class X {{ String.format(\"\"); String.format(\"\", 1); String.format(\"\", 1, 2); String.format(\"\", 1, 2, 3); }}"; String pattern = "'_Instance.'_MethodCall('_Parameter{2,3})"; assertEquals(2, findMatchesCount(source, pattern)); }
testFindMethodCallWithTwoOrThreeParameters
291,817
void () { String source = """ class A { void a() {} void b() throws E1 {} void c() throws E1, E2{} void d() throws E1, E2, E3 {} }"""; String pattern1 = """ class '_A { '_type 'method() throws '_E{0,0}; }"""; assertEquals(1, findMatchesCount(source, pattern1)); String pattern2 = """ class '_A { '_type 'method () throws...
testFindMethodWithCountedExceptionsInThrows
291,818
void () { String source = """ class A { void a() {} static void b() {} void c() { a(); b(); } } class B extends A { void d() { a(); b(); } }"""; String pattern1 = "this.a()"; assertEquals(2, findMatchesCount(source, pattern1)); }
testFindMethodsCalledWithinClass
291,819
void () {}
b
291,820
void () { String source = """ class A { String value; A(String v) { value = (value); System.out.println(((2))); System.out.println(2); } }"""; String pattern1a = "'_value='_value"; assertEquals(1, findMatchesCount(source, pattern1a)); String pattern1b = "System.out.println('_v);\n" + "System.out.println('_v);"; assertE...
testFindReferenceWithParentheses
291,821
int () { return (Integer.parseInt("3")); }
foo
291,822
void () { String source = """ class A { protected String s; A(String t) { this.s = s; t = t; s = this.s; } } class B extends A { B(String t) { super.s = s; } }"""; String pattern = "'_var='_var"; assertEquals(4, findMatchesCount(source, pattern)); }
testFindSelfAssignment
291,823
void () { String source = """ class LambdaParameter { void x() { String s; java.util.function.Consumer<String> c = a -> System.out.println(a); java.util.function.Consumer<String> c2 = a -> System.out.println(a); } }"""; assertEquals("should find lambda parameter", 3, findMatchesCount(source, "String '_a;")); assertEqua...
testFindLambdaParameter
291,824
void () { String source = """ public interface IntFunction<R> { R apply(int value); } public interface Function<T, R> { R apply(T t); } class A { void m() { Runnable q = () -> { /*comment*/ }; Runnable r = () -> { System.out.println(); }; IntFunction<String> f = a -> "hello"; Function<String, String> g = a -> "world"; ...
testFindLambdas
291,825
void (String[] args) { System.out.println(Function.<String>identity().andThen((a) -> { String prefix = a; return new Function<String, String>() { @Override public String apply(String b) { return prefix + b; } }; }).apply("a").apply("b")); }
main
291,826
String (String b) { return prefix + b; }
apply
291,827
String (String b) { '_Statement2; }
apply
291,828
void (String[] args) { //need to match this JSTestUtils.testES6("myProject", () -> { doTest1(); doTest2(); }); }
main
291,829
void () { }
doTest1
291,830
void () { }
doTest2
291,831
void (Object project, Runnable runnable) { runnable.run(); }
testES6
291,832
void () { String source = """ interface XYZ { default void m() { System.out.println(); } void f(); void g(); } interface ABC { void m(); } interface KLM { } interface I { void m(); }"""; String pattern1 = "interface '_Class { default '_ReturnType 'MethodName('_ParameterType '_Parameter*);}"; assertEquals("should find d...
testFindDefaultMethods
291,833
void () { String source = """ class A { Runnable r = System.out::println; Runnable s = this::hashCode; Runnable t = this::new; Runnable u = @AA A::new; static { System.out.println(); } }"""; String pattern1 = "System . out :: println"; assertEquals("should find method reference", 1, findMatchesCount(source, pattern1));...
testFindMethodReferences
291,834
void () { String s = """ class X { void x(String[] tt, String[] ss, String s) {} }"""; assertEquals("don't throw exception during matching", 0, findMatchesCount(s, "void '_Method('_ParameterType '_Parameter*, '_LastType[] '_lastParameter);")); String s2 = """ class X { void x() { x(); } }"""; assertEquals("don't throw ...
testNoException
291,835
void () { String source = ""; try { findMatchesCount(source, "/*$A$a*/"); fail("malformed pattern warning expected"); } catch (MalformedPatternException ignored) {} try { findMatchesCount(source, "class $A$Visitor {}"); fail("malformed pattern warning expected"); } catch (MalformedPatternException ignored) { } try { St...
testNoUnexpectedException
291,836
void () { final String source = ""; try { findMatchesCount(source, "import java.util.ArrayList;"); fail("malformed pattern warning expected"); } catch (MalformedPatternException ignored) {} try { findMatchesCount(source, "\\'aa\\'"); fail("malformed pattern warning expected"); } catch (MalformedPatternException ignored...
testInvalidPatternWarnings
291,837
void () { final CompiledPattern pattern = compilePattern("class A extends '_B* {}", true); assertEquals("MAXIMUM UNLIMITED not applicable for B", checkApplicableConstraints(options, pattern)); assertEquals("MINIMUM ZERO not applicable for b", checkApplicableConstraints(options, compilePattern("'_a?.'_b?", true))); asse...
testApplicableConstraints
291,838
CompiledPattern (String criteria, boolean checkForErrors) { options.fillSearchCriteria(criteria); options.setFileType(JavaFileType.INSTANCE); return PatternCompiler.compilePattern(getProject(), options, checkForErrors, false); }
compilePattern
291,839
void () { String source = """ class Foo { static class Bar {} } class A {{ new Foo.Bar(); }}"""; String pattern = "new Foo.Bar();"; assertEquals("should find qualified with outer class", 1, findMatchesCount(source, pattern)); }
testFindInnerClass
291,840
void () { String source = """ abstract class A<T/*1*/> implements java.util.List<T/*2*/>, /*3*/java.io.Serializable { @SuppressWarnings({"one",/*10*/ "two"}) public /*11*/ static void m(/*12*/) { System./*4*/out.println(/*5*/); A<String/*6*/> a1 = new A(){}; int i = 1 + /*7*/ + 2; try (java.io.FileInputStream /*8*/in =...
testFindCommentsEverywhere
291,841
void () { String source = """ /* HELLO */ class A<T> { private char b = 'C'; void m() { @X String s = ""; s.equals(""); s = s; this.b = 'D'; } }"""; String pattern1 = "a"; assertEquals("should find symbol case insensitively", 1, findMatchesCount(source, pattern1)); String pattern2 = "class a {}"; assertEquals("should f...
testCaseInsensitive
291,842
void () { String source = """ class A {{ try (InputStream in = new FileInputStream("tmp")) { } try { } catch (FileNotFoundException e) { } finally {} try { } catch(NullPointerException | UnsupportedOperationException e) { throw e; } catch(Exception e) { throw new RuntimeException(e); } finally {} try { throw new NoRout...
testFindTry
291,843
void () { String source = """ class A { void f(int i) { assert i > 0; assert i < 10 : "i: " + i; assert i == 5; } }"""; assertEquals("find assert statements", 3, findMatchesCount(source, "assert '_a;")); assertEquals("find assert statements 2", 3, findMatchesCount(source, "assert '_a : '_b?;")); assertEquals("find asse...
testFindAsserts
291,844
void () { String source = """ class A { void f() { int i = 1 + 2; int j = 1 + 2 + 3; int k = 1 + 2 + 3 + 4; } }"""; assertEquals("find polyadic expression", 3, findMatchesCount(source, "'_a + '_b+")); assertEquals("find polyadic expression of 3 operands", 1, findMatchesCount(source, "'_a + '_b{2,2}")); assertEquals("fi...
testPolyadicExpression
291,845
void () { String source = """ class A { int i; int j, /*1*/ k; int l, /*2*/ m, n; { int o, p, q; } }"""; assertEquals("find multiple fields in one declaration 1", 3, findMatchesCount(source, "'_a '_b{2,100};")); assertEquals("find multiple fields in one declaration 2", 3, findMatchesCount(source, "int '_b{2,100};")); a...
testMultipleFieldsInOneDeclaration
291,846
void () { String source = """ class X { static {} static {} static { System.out.println(); } void one() {} void two() { System.out.println(); } <T> T three() { return null; } }"""; assertEquals("find with simple method pattern", 2, findMatchesCount(source, "void '_a();")); assertEquals("find with simple method pattern ...
testFindWithSimpleMemberPattern
291,847
void () { String source = """ class X { final int var1; void a(final int var2) { final int var3; } }"""; assertEquals("parameters and local variables are not package-private", 1, findMatchesCount(source, "@Modifier(\"packageLocal\") '_T '_a;")); assertEquals("any variable can be final", 3, findMatchesCount(source, "@Mo...
testFindPackageLocalAndInstanceFields
291,848
void () { String source = """ interface Foo { <T> T bar(); <S, T> void bar2(S s, T t); } class X { <T> X(T t) {} X() {} void x(Foo foo) { foo.<String>bar(); foo.<Integer>bar(); String s = foo.bar(); foo.bar2(1, 2); } void y(String s) { new <String>X(); new <String>X(); new X(); new X() {}; new <String>X("") {}; new <St...
testFindParameterizedMethodCalls
291,849
void () { String source = """ class A<X, Y> {} class B {{ A<Integer, String> a1 = new A<>(); A<Integer, String> a2 = new A<Integer, String>(); A<Double, Boolean> a3 = new A<>(); A<Double, Boolean> a4 = new A<>(); }}"""; assertEquals("find diamond new expressions", 3, findMatchesCount(source, "new A<>()")); assertEquals...
testFindDiamondTypes
291,850
void () { String source = """ class A { public String toString() { System.out.println(); if (false) { toString(); this.toString(); } return super.toString(); } }"""; assertEquals("find super call", 1, findMatchesCount(source, "super.'_m()")); assertEquals("find super and non super call", 2, findMatchesCount(source, "'_...
testFindSuperCall
291,851
String () { System.out.println(); if (false) { toString(); this.toString(); } return super.toString(); }
toString
291,852
boolean (Object o) { return super.equals(o); }
equals
291,853
void () { String source1 = """ class Two { Two x; void f() { Two a = x.x.x; Two b = x.x.x.x; } }"""; assertEquals(1, findMatchesCount(source1, "x.x.x.'_x")); String source2 = """ import static java.lang.String.*; class One { void f() { valueOf(1); String.valueOf(1); java.lang.String.valueOf(1); Integer.valueOf(1); } }"...
testFindWithQualifiers
291,854
void () { String source1 = """ import java.util.*; class X { void x() { ArrayList<String> fooList = new ArrayList<>(); ArrayList<Integer> barList = new ArrayList<>(); someStuff(fooList); // find this! someStuff(barList); // don't find this one someStuff(Collections.singletonList(1)); // also match this one } void someS...
testSearchTypes
291,855
int () { return 0; }
size
291,856
String (int index) { return null; }
get
291,857
void () { String source = """ class X { @Deprecated void a() {} void b() {} void c() { a(); b(); b(); } }"""; assertEquals("find calls to deprecated methods", 1, findMatchesCount(source, "'_instance?.'_call:[ref( \"@Deprecated void '_x();\" )] ()")); assertEquals("find calls to non-deprecated methods", 2, findMatchesCo...
testSearchReferences
291,858
void () { String source = """ class ExampleTest { void m(String example) { synchronized (ExampleTest.class) { // comment if (example == null) { } } } }"""; assertEquals("find code ignoring comments", 1, findMatchesCount(source, "synchronized ('_a.class) { if ('_b == null) {}}")); String source2 = """ class X { int[] is...
testSearchIgnoreComments
291,859
void () { final String s = """ class X { void x() { String x = null; x: System.out.println(); y: System.out.println(); } }"""; assertEquals("Find statement labels", 4, findMatchesCount(s, "x")); assertEquals("Find statement label variable", 2, findMatchesCount(s, "'_l : '_s;")); }
testFindLabeledStatements
291,860
void () { final String s = """ class X { void m() { outer: for (int i = 0; i < 10; i++) { if (i == 1) break outer; if (i == 2) break; if (i == 3) break nowhere; } } }"""; assertEquals("Find break statements", 3, findMatchesCount(s, "break;")); assertEquals("Find labeled break statements", 2, findMatchesCount(s, "break ...
testFindBreakContinue
291,861
void () { final String s = """ class X { void m() { var s = "hi"; String t = "bye"; } }"""; assertEquals("find var statement", 1, findMatchesCount(s, "var '_x;")); assertEquals("find String variables", 2, findMatchesCount(s, "String '_x;")); assertEquals("find String variables 2", 2, findMatchesCount(s, "var '_x = \"'_...
testFindVarStatement
291,862
void () { final String s = """ class X { void a() { return; } int b() { return 1; } Object c() { return new Object(); } }"""; assertEquals("find return without value", 1, findMatchesCount(s, "return '_x{0,0};")); assertEquals("find return with value", 2, findMatchesCount(s, "return '_x;")); assertEquals("find returns",...
testFindReturn
291,863
void () { final String s = """ class X { void m() throws RuntimeException, IllegalStateException, IllegalArgumentException {} void n() throws RuntimeException {} void o() throws RuntimeException {} }"""; assertEquals("find method throwing only RuntimeException", 2, findMatchesCount(s, "'_T '_m() throws '_RE:RuntimeExce...
testMatchInAnyOrderWithMultipleVars
291,864
void () { final String in = """ import java.util.List; class X { List a; List<String> b; List<?> c; List<? extends Object> d; List<? extends Number> e; List<? extends Number> f; List<? extends Integer> g; }"""; assertEquals("List<?> should match List<? extends Object>", 2, findMatchesCount(in, "'_A<?>")); assertEquals(...
testMatchWildcards
291,865
void () { String in = """ class X { void x(boolean b) { if (b) { System.out.println(); System.out.println(); } if (b) { System.out.println(); } else { System.out.println(); } } }"""; assertEquals("Should find if without else", 1, findMatchesCount(in, "if ('_a) '_b; else '_c{0,0};")); }
testIfStatements
291,866
void () { final String in = """ class X { void x(int i) { switch (i) { case 10: System.out.println(10); } switch (i) { case 1: default: } switch (i) { case 1: default: } switch (i) { case 1: case 2: default: } } }"""; assertEquals("Should find switch with one case", 1, findMatchesCount(in, """ switch ('_a) { case '_c :...
testSwitchStatements
291,867
void () { final String in = """ class X { void dummy(int i) { int j = switch (i) { case 10 -> { System.out.println(10); } default -> {} }; int k = switch (i) { case 10 -> { yield 1; } default -> 0; }; int l = switch (i) { case 1,2,3: break; case 5: break; }; } }"""; assertEquals("find expressions & statements", 2, find...
testFindSwitchExpressions
291,868
void () { String in = """ class SomePageObject { @FindBy(name = "first-name") private WebElement name; @FindBy(name = "first-name") private WebElement firstName; } class SomePageObject2 { @FindBy(name = "last-name") private WebElement name; @FindBy(name = "first-name") private WebElement firstName; }"""; assertEquals("...
testRepeatedVars
291,869
void () { String in = """ class X {{ for (int i = 0; i < 10; i++) {} for (int i = 0; i < 10; i++) {} for (int i = 0; i < 10; i++) {} for (int i = 0; i < 10; i++) {} for (;;) {} for (int i = 0; ;) {} for (int i = 0; true; ) {} }}"""; assertEquals("find all for loops", 7, findMatchesCount(in, "for(;;) '_st;")); assertEqu...
testForStatement
291,870
void () { String in = """ class X { public String toString(X this) { return "x"; } void f() {} void g() {} }"""; assertEquals("find methods with receiver parameter", 3, findMatchesCount(in, "'_RT '_m();")); assertEquals("find methods with explicit receiver parameter", 1, findMatchesCount(in, "'_RT '_m('_T this);")); as...
testReceiverParameter
291,871
String (X this) { return "x"; }
toString
291,872
void () { String in = """ class X {} class Y {} class Z {} record R() {} record T(int i, int j) {} record S(double x, double y) {}"""; assertEquals("find empty record", 1, findMatchesCount(in, "record '_X() {}")); assertEquals("find two component records", 2, findMatchesCount(in, "record '_X('_T '_t{2,2}) {}")); assert...
testRecords
291,873
void () { String in = """ class X { void x(Object o) { if (o instanceof String) {} if (o instanceof String s) {} if (o instanceof String s) {} } }"""; assertEquals("find instanceof", 3, findMatchesCount(in, "'_operand instanceof '_Type")); assertEquals("find pattern matching instanceof", 2, findMatchesCount(in, "'_oper...
testPatternMatchingInstanceof
291,874
void () { String s1 = "<a/>"; String s2 = "<a/>"; String s3 = "<a><b/></a>"; String expectedResult = "<a><b/></a>"; assertEquals("First tag replacement", expectedResult, replace(s1, s2, s3)); String s4 = """ <group id="EditorTabPopupMenu"> <reference id="Compile"/> <reference id="RunContextPopupGroup"/> <reference id="...
testReplaceXmlAndHtml
291,875
void () { String in = "<input class=\"other\" type=\"text\" ng-model=\"someModel\" placeholder=\"Some placeholder\" />"; String what = "<input '_a* />"; String by = "<input $a$ id=\"someId1\" />"; String expected = "<input class=\"other\" type=\"text\" ng-model=\"someModel\" placeholder=\"Some placeholder\" id=\"someId...
testHtmlAddAttribute
291,876
void () { String in = "<input class=\"other\" placeholder=\"Some placeholder\">"; String what = "<input 'a:[regex( placeholder )]>"; String by = ""; String expected = "<input class=\"other\">"; assertEquals(expected, replace(in, what, by)); String in2 = "<img src=\"foobar.jpg\" alt=\"alt\" width=\"108\" height=\"71\" s...
testRemoveAttribute
291,877
void () { String in = """ <a> <b>liberation</b> <c>remuneration</c> </a>"""; String what = "<'tag:[regex( c )]>'_text</'tag>"; String by = ""; String expected = """ <a> <b>liberation</b> </a>"""; assertEquals(expected, replace(in, what, by)); }
testRemoveTag
291,878
void () { final ReplacementVariableDefinition definition = new ReplacementVariableDefinition("result"); definition.setScriptCodeConstraint("value.getText().toInteger() + 1"); options.addVariableDefinition(definition); String in = """ <!doctype html> <html> <head> <title class="EXAMPLE">Structural Replace Example</title...
testReplaceTargetText
291,879
void () { String in = "<input id=\"one\" class=\"no\">"; String what = "<'_tag '_attr:[regex( id )]=\\''value\\'>"; String by = "\"two\""; String expected = "<input id=\"two\" class=\"no\">"; assertEquals(expected, replace(in, what, by)); }
testReplaceAttributeValue
291,880
String () { return PlatformTestUtil.getCommunityPath() + "/platform/structuralsearch/testData/"; }
getTestDataPath
291,881
void () { String html = "<HTML><HEAD><TITLE>Hello Worlds</TITLE></HEAD><body><img src='test.gif'></body></HTML>"; String pattern = "<title>'_a</title>"; options.setCaseSensitiveMatch(false); assertEquals("case insensitive search", 1, findMatchesCount(html, pattern, HtmlFileType.INSTANCE)); String pattern2 = "<'t SRC=\"...
testHtmlSearchCaseInsensitive
291,882
void () { String html = "<HTML><HEAD><TITLE>Hello Worlds</TITLE></HEAD><body><img src='test.gif'><body></HTML>"; String pattern = "<title>'_a</title>"; options.setCaseSensitiveMatch(true); assertEquals("case sensitive search", 0, findMatchesCount(html, pattern, HtmlFileType.INSTANCE)); }
testHtmlSearchCaseSensitive
291,883
void () { String s1 = "<aaa><bbb class=\"11\"></bbb></aaa><bbb class=\"22\"></bbb>"; String s2 = "<bbb></bbb>"; String s2_2 = "<bbb/>"; String s2_3 = "<'t:[ regex( aaa ) ] />"; String s2_4 = "<'_ 't:[ regex( class ) ]=\"'_\" />"; String s2_5 = "<'_ '_=\"'t:[ regex( 11 ) ]\" />"; assertEquals("Simple xml find", 2, findM...
testXmlSearch
291,884
void () { String source = "<html><title>title</title></html>"; try { findMatchesCount(source, "<'_tag>", XmlFileType.INSTANCE); } catch (MalformedPatternException e) { fail(); } try { findMatchesCount(source, "<'_tag '_attr>", XmlFileType.INSTANCE); } catch (MalformedPatternException e) { fail(); } }
testNoUnexpectedException
291,885
void () { String source = "<x>z</x>"; try { findMatchesCount(source, "<title>$A$$</title>", HtmlFileType.INSTANCE); fail(); } catch (MalformedPatternException ignore) {} try { findMatchesCount(source, "<x>1<3</x>", XmlFileType.INSTANCE); fail(); } catch (MalformedPatternException ignore) {} try { findMatchesCount(sourc...
testInvalidPatternWarnings
291,886
void () { String source = "<ul><li>one</li></ul><li>two</li><li>three</li>"; String pattern1 = "[within( \"<ul>'content*</ul>\" )]<'li />"; assertEquals("within predicate", 1, findMatchesCount(source, pattern1, XmlFileType.INSTANCE)); String pattern1a = "[within( \"<ul>'_content*</ul>\" )]<'li />"; assertEquals("within...
testWithinPredicate
291,887
void () { String source = """ <html> <style type="text/css"> .stretchFormElement { width: auto; } </style> <img src="madonna.jpg" alt='Foligno Madonna, by Raphael' one="tro"/> </html>"""; String pattern = "<'_a type=\"text/css\">'_content*</'_a>"; assertEquals("find tag with css content", 1, findMatchesCount(source, pa...
testCssStyleTag
291,888
void () { String source = """ <user id="1"> <first_name>Max</first_name> <!-- asdf --> <last_name>Headroom</last_name> </user>"""; String pattern = "<first_name>$A$</first_name><last_name>$B$</last_name>"; assertEquals("find tag ignoring comments", 1, findMatchesCount(source, pattern, XmlFileType.INSTANCE)); }
testSearchIgnoreComments
291,889
void () { String in = "<blockquote>one two <!-- and I cannot emphasize this enough --> three</blockquote>"; assertEquals("find comment", 1, findMatchesCount(in, "<!-- '_x -->", HtmlFileType.INSTANCE)); assertEquals("find comment 2", 1, findMatchesCount(in, "<!-- and I cannot emphasize this enough -->", HtmlFileType.INS...
testComments
291,890
String () { return PlatformTestUtil.getCommunityPath() + "/platform/structuralsearch/testData/html/"; }
getTestDataPath
291,891
void () { String s1 = "<body><p class=\"11\"> AAA </p><p class=\"22\"></p> <p> ZZZ </p> <p/> <p/> <p/> </body>"; String s2 = "<p '_a{0,0}=\"'_t:[ regex( 11 ) ]\"> '_content? </p>"; assertEquals(5, findMatchesCount(s1, s2, XmlFileType.INSTANCE)); }
testXmlSearch2
291,892
void () { try { findMatchesCount("", "<H", HtmlFileType.INSTANCE); fail(); } catch (MalformedPatternException ignore) {} findMatchesCount("", "<H>", HtmlFileType.INSTANCE); // although invalid HTML, should not report an error findMatchesCount("", "<A href>", XmlFileType.INSTANCE); // although missing attribute value, s...
testErroneousPatterns
291,893
void () { final Configuration[] templates = JavaPredefinedConfigurations.createPredefinedTemplates(); final Map<String, Configuration> configurationMap = Stream.of(templates).collect(Collectors.toMap(Configuration::getName, x -> x)); doTest(configurationMap.remove(SSRBundle.message("predefined.configuration.logging.wit...
testAll
291,894
void (final int i, int j, int k) { System.out.println(i); }
m
291,895
void (final int i, int j, int k) { System.out.println(i); }
m
291,896
Object () { if (o == null) { synchronized (X.class) { if (o == null) { return o; } } } }
get
291,897
LanguageLevel () { return LanguageLevel.JDK_16; }
getLanguageLevel
291,898
void () { final Configuration[] templates = new XmlStructuralSearchProfile().getPredefinedTemplates(); final Map<String, Configuration> configurationMap = Stream.of(templates).collect(Collectors.toMap(Configuration::getName, x -> x)); doTest(configurationMap.remove(SSRBundle.message("predefined.template.li.not.containe...
testAll
291,899
void () { doTest("class A {<EOLError descr=\"'}' expected\"></EOLError>"); }
testSimpleError