Changeset 8936 in josm for trunk/test/unit


Ignore:
Timestamp:
2015-10-23T23:34:29+02:00 (9 years ago)
Author:
Don-vip
Message:

add unit test to check syntax validity of all MapCSSTagChecker rules

Location:
trunk/test/unit/org/openstreetmap/josm
Files:
2 added
1 edited

Legend:

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

    r8857 r8936  
    2828import org.openstreetmap.josm.data.validation.Severity;
    2929import org.openstreetmap.josm.data.validation.TestError;
     30import org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker.ParseResult;
    3031import org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker.TagCheck;
    3132import org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.ParseException;
     
    4647    static MapCSSTagChecker buildTagChecker(String css) throws ParseException {
    4748        final MapCSSTagChecker test = new MapCSSTagChecker();
    48         test.checks.putAll("test", TagCheck.readMapCSS(new StringReader(css)));
     49        test.checks.putAll("test", TagCheck.readMapCSS(new StringReader(css)).parseChecks);
    4950        return test;
    5051    }
     
    5253    @Test
    5354    public void testNaturalMarsh() throws Exception {
    54         final List<MapCSSTagChecker.TagCheck> checks = MapCSSTagChecker.TagCheck.readMapCSS(new StringReader("" +
     55        ParseResult result = MapCSSTagChecker.TagCheck.readMapCSS(new StringReader("" +
    5556                "*[natural=marsh] {\n" +
    5657                "   throwWarning: tr(\"{0}={1} is deprecated\", \"{0.key}\", tag(\"natural\"));\n" +
     
    5960                "   fixAdd: \"wetland=marsh\";\n" +
    6061                "}"));
     62        final List<MapCSSTagChecker.TagCheck> checks = result.parseChecks;
    6163        assertEquals(1, checks.size());
     64        assertTrue(result.parseErrors.isEmpty());
    6265        final MapCSSTagChecker.TagCheck check = checks.get(0);
    6366        assertNotNull(check);
     
    8790                "fixChangeKey: \"highway => construction\";\n" +
    8891                "fixAdd: \"highway=construction\";\n" +
    89                 "}")).get(0);
     92                "}")).parseChecks.get(0);
    9093        final Command command = check.fixPrimitive(p);
    9194        assertTrue(command instanceof SequenceCommand);
Note: See TracChangeset for help on using the changeset viewer.