Search in sources :

Example 1 with VarDef

use of org.eclipse.n4js.xpect.config.VarDef in project n4js by eclipse.

the class VarSubstExpectationCollection method createItems.

protected List<ExpectationItem> createItems(String item, boolean negated, boolean quoted2, boolean escaped) {
    Matcher m = pVar.matcher(item);
    boolean foundMatch = m.find();
    if (foundMatch) {
        // get variablename
        String name = m.group(1);
        VarDef varDef = runData.getVar(name);
        ArrayList<ExpectationItem> ret = new ArrayList<>();
        for (ValueList mem : varDef.mlist) {
            for (String s : mem.evaluate(runData.getResourceUnderTest())) {
                ret.add(super.createItem(s, negated, quoted2, escaped));
            }
        }
        return ret;
    } else {
        return Arrays.asList(super.createItem(item, negated, quoted2, escaped));
    }
}
Also used : VarDef(org.eclipse.n4js.xpect.config.VarDef) Matcher(java.util.regex.Matcher) ValueList(org.eclipse.n4js.xpect.config.ValueList) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)1 Matcher (java.util.regex.Matcher)1 ValueList (org.eclipse.n4js.xpect.config.ValueList)1 VarDef (org.eclipse.n4js.xpect.config.VarDef)1