Changeset 6677 in josm for trunk/test/unit


Ignore:
Timestamp:
2014-01-12T23:04:43+01:00 (11 years ago)
Author:
simon04
Message:

see #9414 fix #9566: MapCSS validator: allow error message to access tags of primitive

For instance, throwWarning: tr("{0} is bad", tag("highway")).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/MapCSSTagCheckerTest.java

    r6636 r6677  
    3838        final List<MapCSSTagChecker.TagCheck> checks = MapCSSTagChecker.TagCheck.readMapCSS(new StringReader("" +
    3939                "*[natural=marsh] {\n" +
    40                 "   throwWarning: tr(\"{0} is deprecated\", \"{0.tag}\");\n" +
     40                "   throwWarning: tr(\"{0}={1} is deprecated\", \"{0.key}\", tag(\"natural\"));\n" +
    4141                "   fixRemove: \"{0.key}\";\n" +
    4242                "   fixAdd: \"natural=wetland\";\n" +
     
    4646        final MapCSSTagChecker.TagCheck check = checks.get(0);
    4747        assertThat(check, notNullValue());
    48         assertThat(check.getDescription(), is("{0.tag} is deprecated"));
     48        assertThat(check.getDescription(null), is("{0.key}=null is deprecated"));
    4949        assertThat(check.change.get(0).apply(null), is(new Tag("{0.key}")));
    5050        assertThat(check.change.get(1).apply(null), is(new Tag("natural", "wetland")));
     
    8383                if (isError != i.getValue()) {
    8484                    final String error = MessageFormat.format("Expecting test ''{0}'' (i.e., {1}) to {2} {3} (i.e., {4})",
    85                             check.getMessage(), check.rule.selectors, i.getValue() ? "match" : "not match", i.getKey(), p.getKeys());
     85                            check.getMessage(p), check.rule.selectors, i.getValue() ? "match" : "not match", i.getKey(), p.getKeys());
    8686                    System.err.println(error);
    8787                    assertionErrors.add(error);
Note: See TracChangeset for help on using the changeset viewer.