use of com.intellij.openapi.application.PathMacroFilter in project intellij-community by JetBrains.
the class PathMacrosCollectorTest method testWithFilter.
public void testWithFilter() throws Exception {
Element root = new Element("root");
final Element testTag = new Element("test");
testTag.setAttribute("path", "$MACRO$");
testTag.setAttribute("ignore", "$PATH$");
root.addContent(testTag);
final Set<String> macros = PathMacrosCollector.getMacroNames(root, null, new PathMacrosImpl());
assertEquals(2, macros.size());
assertTrue(macros.contains("MACRO"));
assertTrue(macros.contains("PATH"));
final Set<String> filtered = PathMacrosCollector.getMacroNames(root, new PathMacroFilter() {
@Override
public boolean skipPathMacros(Attribute attribute) {
return "ignore".equals(attribute.getName());
}
}, new PathMacrosImpl());
assertEquals(1, filtered.size());
assertTrue(macros.contains("MACRO"));
}
use of com.intellij.openapi.application.PathMacroFilter in project intellij-community by JetBrains.
the class PathMacrosCollectorTest method testWithRecursiveFilter.
public void testWithRecursiveFilter() throws Exception {
Element root = new Element("root");
final Element configuration = new Element("configuration");
configuration.setAttribute("value", "some text$macro5$fdsjfhdskjfsd$MACRO$");
configuration.setAttribute("value2", "file://$root$/some/path/just$file$name.txt");
root.addContent(configuration);
final Set<String> macros = PathMacrosCollector.getMacroNames(root, new PathMacroFilter() {
@Override
public boolean recursePathMacros(Attribute attribute) {
return "value".equals(attribute.getName());
}
}, new PathMacrosImpl());
UsefulTestCase.assertSameElements(macros, "macro5", "MACRO", "root");
}
Aggregations