void () { String s = """ class A { def f = { println('Hello1') println('Hello2') } def f1 = { println('Hello') } }"""; doTest(s, """ def $name$ = { '_T+ }""", 0, 0); final PatternContext old = options.getPatternContext(); try { options.setPatternContext(GroovyStructuralSearchProfile.CLASS_CONTEXT); doTest(s, """ def $name$ = { '_T+ }""", 2, 2); } finally { options.setPatternContext(old); } }