Changeset 6513 in josm for trunk/test/unit/org/openstreetmap/josm/data/validation
- Timestamp:
- 2013-12-23T00:13:58+01:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/MapCSSTagCheckerTest.java
r6512 r6513 10 10 import org.openstreetmap.josm.data.osm.Tag; 11 11 import org.openstreetmap.josm.data.osm.Way; 12 import org.openstreetmap.josm.tools.TextTagParser; 12 13 13 14 import java.io.StringReader; … … 55 56 56 57 OsmPrimitive createPrimitiveForAssertion(String assertion) { 57 final String[] x = assertion.split("\\s+"); 58 final String[] x = assertion.split("\\s+", 2); 58 59 final OsmPrimitive p = "n".equals(x[0]) || "node".equals(x[0]) 59 60 ? new Node() … … 66 67 throw new IllegalArgumentException("Expecting n/node/w/way/r/relation, but got " + x[0]); 67 68 } 68 for (int i = 1; i < x.length; i++) { 69 final Tag tag = Tag.ofString(x[i]); 70 p.put(tag.getKey(), tag.getValue()); 69 for (final Map.Entry<String, String> i : TextTagParser.getValidatedTagsFromText(x[1]).entrySet()) { 70 p.put(i.getKey(), i.getValue()); 71 71 } 72 72 return p; … … 95 95 for (final MapCSSTagChecker.TagCheck check : c.checks) { 96 96 for (final Map.Entry<String, Boolean> i : check.assertions.entrySet()) { 97 if (check.matchesPrimitive(createPrimitiveForAssertion(i.getKey())) != i.getValue()) { 98 final String error = "Expecting test '" + check.getMessage() + "' to " + (i.getValue() ? "" : "not ") + "match " + i.getKey(); 97 final OsmPrimitive p = createPrimitiveForAssertion(i.getKey()); 98 if (check.matchesPrimitive(p) != i.getValue()) { 99 final String error = "Expecting test '" + check.getMessage() + "' to " + (i.getValue() ? "" : "not ") + "match " + i.getKey() + ", i.e., " + p.getKeys(); 99 100 System.err.println(error); 100 101 assertionErrors.add(error);
Note:
See TracChangeset
for help on using the changeset viewer.