use of aQute.bnd.osgi.Processor in project bnd by bndtools.
the class MacroTest method testGlobToRegExp.
public void testGlobToRegExp() {
Processor p = new Processor();
Macro m = p.getReplacer();
assertEquals(".*x", m.process("${glob;*x}"));
assertEquals("(?!.*x)", m.process("${glob;!*x}"));
}
use of aQute.bnd.osgi.Processor in project bnd by bndtools.
the class MacroTest method testVersionMaskWithoutTarget.
public void testVersionMaskWithoutTarget() throws IOException {
Processor p = new Processor();
assertEquals("${version;===}", p.getReplacer().process("${version;===}"));
assertTrue(p.check());
}
use of aQute.bnd.osgi.Processor in project bnd by bndtools.
the class MacroTest method testWarning.
public static void testWarning() {
Processor p = new Processor();
p.setProperty("three", "333");
p.setProperty("empty", "");
p.setProperty("real", "true");
Macro m = new Macro(p);
m.process(" ${warning;xw;1;2;3 ${three}}");
m.process(" ${error;xe;1;2;3 ${three}}");
m.process(" ${if;1;$<a>}");
assertTrue("xw", p.getWarnings().get(0).endsWith("xw"));
assertTrue("1", p.getWarnings().get(1).endsWith("1"));
assertTrue("2", p.getWarnings().get(2).endsWith("2"));
assertTrue("3 333", p.getWarnings().get(3).endsWith("3 333"));
assertTrue("xw", p.getErrors().get(0).endsWith("xe"));
assertTrue("1", p.getErrors().get(1).endsWith("1"));
assertTrue("2", p.getErrors().get(2).endsWith("2"));
assertTrue("3 333", p.getErrors().get(3).endsWith("3 333"));
}
use of aQute.bnd.osgi.Processor in project bnd by bndtools.
the class MacroTest method testJoin.
public static void testJoin() {
Processor p = new Processor();
p.setProperty("a", "aaaa");
Macro m = new Macro(p);
assertEquals("aa,bb,cc,dd,ee,ff", m.process("${join;aa,bb,cc,dd,ee,ff}"));
assertEquals("aa,bb,cc,dd,ee,ff", m.process("${join;aa,bb,cc;dd,ee,ff}"));
assertEquals("aa,bb,cc,dd,ee,ff", m.process("${join;aa;bb;cc;dd;ee,ff}"));
assertEquals("aaXbbXccXddXeeXff", m.process("${sjoin;X;aa,bb,cc,dd,ee,ff}"));
assertEquals("aa\nbb\ncc\ndd\nee\nff", m.process("${sjoin;\n;aa,bb,cc;dd,ee,ff}"));
assertEquals("aa\nbb\ncc\ndd\nee\nff", m.process("${unescape;${sjoin;\\n;aa,bb,cc;dd,ee,ff}}"));
}
use of aQute.bnd.osgi.Processor in project bnd by bndtools.
the class MacroTest method testCurrentWorkingDirectory.
/**
* Test replacement of ./ with cwd
*/
public static void testCurrentWorkingDirectory() {
Processor top = new Processor();
// empty
top.setProperty("cwd.1", "./");
// empty
top.setProperty("cwd.2", " ./");
// empty
top.setProperty("cwd.3", "./ ");
// empty
top.setProperty("cwd.4", " ./ ");
// empty
top.setProperty("cwd.5", "|./|");
// empty
top.setProperty("cwd.6", "/.//");
// empty
top.setProperty("cwd.7", ".");
// empty
top.setProperty("cwd.8", " . ");
// empty
top.setProperty("cwd.9", " . /");
// empty
top.setProperty("cwd.10", " .");
// empty
top.setProperty("cwd.11", "| ./|");
// empty
top.setProperty("cwd.12", "|\t./|");
// empty
top.setProperty("cwd.13", "|\r./|");
// empty
top.setProperty("cwd.14", "|\n./|");
String cwd = top.getBase().getAbsolutePath() + "/";
assertEquals(" . ", top.getProperty("cwd.8"));
assertEquals(cwd, top.getProperty("cwd.1"));
assertEquals(" " + cwd, top.getProperty("cwd.2"));
assertEquals(cwd + " ", top.getProperty("cwd.3"));
assertEquals(" " + cwd + " ", top.getProperty("cwd.4"));
assertEquals("|./|", top.getProperty("cwd.5"));
assertEquals("/.//", top.getProperty("cwd.6"));
assertEquals(".", top.getProperty("cwd.7"));
assertEquals(" . /", top.getProperty("cwd.9"));
assertEquals(" .", top.getProperty("cwd.10"));
assertEquals("| " + cwd + "|", top.getProperty("cwd.11"));
assertEquals("|\t" + cwd + "|", top.getProperty("cwd.12"));
assertEquals("|\r" + cwd + "|", top.getProperty("cwd.13"));
assertEquals("|\n" + cwd + "|", top.getProperty("cwd.14"));
}
Aggregations