use of aQute.bnd.osgi.Macro in project bnd by bndtools.
the class MacroTest method testNames.
public static void testNames() {
Processor p = new Processor();
p.setProperty("a", "a");
p.setProperty("aa", "aa");
Macro macro = new Macro(p);
assertEquals("aa", macro.process("${${a}${a}}"));
}
use of aQute.bnd.osgi.Macro in project bnd by bndtools.
the class MacroTest method testSystem.
/**
* Verify system command
*/
public static void testSystem() throws Exception {
// disable this test on windows
if (!"/".equals(File.separator))
return;
Processor p = new Processor();
Macro macro = new Macro(p);
assertEquals("Hello World", macro.process("${system;echo Hello World}"));
assertTrue(macro.process("${system;wc;Hello World}").matches("\\s*[0-9]+\\s+[0-9]+\\s+[0-9]+\\s*"));
}
use of aQute.bnd.osgi.Macro in project bnd by bndtools.
the class MacroTest method testSimple.
public static void testSimple() {
Processor p = new Processor();
p.setProperty("a", "aaaa");
Macro m = new Macro(p);
assertEquals("aaaa", m.process("${a}"));
assertEquals("aaaa", m.process("$<a>"));
assertEquals("aaaa", m.process("$(a)"));
assertEquals("aaaa", m.process("$[a]"));
assertEquals("xaaaax", m.process("x${a}x"));
assertEquals("xaaaaxaaaax", m.process("x${a}x${a}x"));
}
use of aQute.bnd.osgi.Macro in project bnd by bndtools.
the class MacroTest method testFilterOut.
public static void testFilterOut() {
Processor p = new Processor();
p.setProperty("a", "aaaa");
Macro m = new Macro(p);
assertEquals("bb,dd,ff", m.process("${filterout;aa,bb,cc,dd,ee,ff;[ace]+}"));
assertEquals("bb,dd,ff", m.process("${filterout;${a},bb,cc,dd,ee,ff;[ace]+}"));
assertEquals("aaaa,cc,ee", m.process("${filterout;${a},bb,cc,dd,ee,ff;[^ace]+}"));
}
use of aQute.bnd.osgi.Macro in project bnd by bndtools.
the class MacroTest method testRange.
public static void testRange() throws Exception {
Processor proc = new Processor();
Macro macro = new Macro(proc);
assertEquals("[1.0,1.0]", macro.process("${range;[==,==];1.0.0}"));
assertEquals("[1.0.0,1.0.1]", macro.process("${range;[===,==+];1.0.0}"));
assertEquals("[0.1.0,0.1.2)", macro.process("${range;[=+0,=++);0.0.1}"));
assertEquals("[0.0.9,0.1.2)", macro.process("${range;[==9,=++);0.0.1}"));
assertEquals(0, proc.getErrors().size());
assertEquals(0, proc.getWarnings().size());
proc.setProperty("@", "1.2.3");
assertEquals("[1.0.0,2)", macro.process("${range;[=00,+)}"));
proc.clear();
macro.process("${range;=+0,=++;0.0.1}");
assertEquals(1, proc.getErrors().size());
assertEquals(1, proc.getWarnings().size());
proc.clear();
macro.process("${range;[+,=)}");
assertEquals(1, proc.getErrors().size());
assertEquals(1, proc.getWarnings().size());
}
Aggregations