Changeset 13004 in josm
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/template_engine/Variable.java
r13003 r13004 25 25 * Constructs a new {@code Variable}. 26 26 * @param variableName the variable name (i.e. the key in the data provider key-value mapping); 27 * will be considered "special" if the variable name starts with {@link SPECIAL_VARIABLE_PREFIX}27 * will be considered "special" if the variable name starts with {@link #SPECIAL_VARIABLE_PREFIX} 28 28 */ 29 29 public Variable(String variableName) { -
trunk/test/unit/org/openstreetmap/josm/tools/template_engine/TemplateParserTest.java
r12656 r13004 59 59 public void testConditionWhitespace() throws ParseError { 60 60 TemplateParser parser = new TemplateParser("?{ '{name} {desc}' | '{name}' | '{desc}' }"); 61 Condition condition = new Condition( );62 condition.getEntries().add(CompoundTemplateEntry.fromArray(new Variable("name"), new StaticText(" "), new Variable("desc")));63 condition.getEntries().add(new Variable("name"));64 condition.getEntries().add(new Variable("desc"));61 Condition condition = new Condition(Arrays.asList( 62 CompoundTemplateEntry.fromArray(new Variable("name"), new StaticText(" "), new Variable("desc")), 63 new Variable("name"), 64 new Variable("desc"))); 65 65 ReflectionAssert.assertReflectionEquals(condition, parser.parse()); 66 66 } … … 73 73 public void testConditionNoWhitespace() throws ParseError { 74 74 TemplateParser parser = new TemplateParser("?{'{name} {desc}'|'{name}'|'{desc}'}"); 75 Condition condition = new Condition( );76 condition.getEntries().add(CompoundTemplateEntry.fromArray(new Variable("name"), new StaticText(" "), new Variable("desc")));77 condition.getEntries().add(new Variable("name"));78 condition.getEntries().add(new Variable("desc"));75 Condition condition = new Condition(Arrays.asList( 76 CompoundTemplateEntry.fromArray(new Variable("name"), new StaticText(" "), new Variable("desc")), 77 new Variable("name"), 78 new Variable("desc"))); 79 79 ReflectionAssert.assertReflectionEquals(condition, parser.parse()); 80 80 } … … 92 92 public void testConditionSearchExpression() throws ParseError, SearchParseError { 93 93 TemplateParser parser = new TemplateParser("?{ admin_level = 2 'NUTS 1' | admin_level = 4 'NUTS 2' | '{admin_level}'}"); 94 Condition condition = new Condition( );95 condition.getEntries().add(new SearchExpressionCondition(compile("admin_level = 2"), new StaticText("NUTS 1")));96 condition.getEntries().add(new SearchExpressionCondition(compile("admin_level = 4"), new StaticText("NUTS 2")));97 condition.getEntries().add(new Variable("admin_level"));94 Condition condition = new Condition(Arrays.asList( 95 new SearchExpressionCondition(compile("admin_level = 2"), new StaticText("NUTS 1")), 96 new SearchExpressionCondition(compile("admin_level = 4"), new StaticText("NUTS 2")), 97 new Variable("admin_level"))); 98 98 ReflectionAssert.assertReflectionEquals(condition, parser.parse()); 99 99 }
Note:
See TracChangeset
for help on using the changeset viewer.