Changeset 11057 in josm
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/template_engine/Condition.java
r9079 r11057 41 41 public String toString() { 42 42 StringBuilder sb = new StringBuilder(); 43 sb.append("?{ ");43 sb.append("?{ "); 44 44 for (TemplateEntry entry: entries) { 45 45 if (entry instanceof SearchExpressionCondition) { … … 48 48 sb.append('\'').append(entry).append('\''); 49 49 } 50 sb.append( '|');50 sb.append(" | "); 51 51 } 52 sb.setLength(sb.length() - 3); 53 sb.append(" }"); 52 54 return sb.toString(); 53 55 } -
trunk/src/org/openstreetmap/josm/tools/template_engine/Variable.java
r8846 r11057 56 56 @Override 57 57 public String toString() { 58 return '{' + variableName + '}';58 return '{' + (special ? SPECIAL_VARIABLE_PREFIX : "") + variableName + '}'; 59 59 } 60 60 -
trunk/test/unit/org/openstreetmap/josm/tools/template_engine/TemplateParserTest.java
r10846 r11057 174 174 entry.appendText(sb, dataProvider); 175 175 Assert.assertEquals("name=waypointName, number=10", sb.toString()); 176 Assert.assertEquals("{special:everything}", entry.toString()); 176 177 } 177 178 … … 333 334 Assert.assertEquals("child2", sb.toString()); 334 335 } 336 337 @Test 338 public void testToStringCanBeParsedAgain() throws Exception { 339 final String s1 = "?{ '{name} ({desc})' | '{name} ({cmt})' | '{name}' | '{desc}' | '{cmt}' }"; 340 final String s2 = new TemplateParser(s1).parse().toString(); 341 final String s3 = new TemplateParser(s2).parse().toString(); 342 Assert.assertEquals(s1, s2); 343 Assert.assertEquals(s2, s3); 344 } 335 345 }
Note:
See TracChangeset
for help on using the changeset viewer.