Changeset 11014 in josm for trunk/test


Ignore:
Timestamp:
2016-09-17T21:57:10+02:00 (3 years ago)
Author:
Don-vip
Message:

fix #13630 - proper validation of invalid mapcss rules

File:
1 edited

Legend:

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

    r10945 r11014  
    5252    }
    5353
     54    /**
     55     * Test {@code natural=marsh}.
     56     * @throws ParseException if a parsing error occurs
     57     */
    5458    @Test
    55     public void testNaturalMarsh() throws Exception {
    56         ParseResult result = MapCSSTagChecker.TagCheck.readMapCSS(new StringReader("" +
     59    public void testNaturalMarsh() throws ParseException {
     60        ParseResult result = MapCSSTagChecker.TagCheck.readMapCSS(new StringReader(
    5761                "*[natural=marsh] {\n" +
    5862                "   group: tr(\"deprecated\");\n" +
     
    8690    }
    8791
     92    /**
     93     * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/10913">Bug #10913</a>.
     94     * @throws ParseException if a parsing error occurs
     95     */
    8896    @Test
    89     public void testTicket10913() throws Exception {
     97    public void testTicket10913() throws ParseException {
    9098        final OsmPrimitive p = OsmUtils.createPrimitive("way highway=tertiary construction=yes");
    9199        final TagCheck check = TagCheck.readMapCSS(new StringReader("way {" +
     
    101109    }
    102110
     111    /**
     112     * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/9782">Bug #9782</a>.
     113     * @throws ParseException if a parsing error occurs
     114     */
    103115    @Test
    104     public void testTicket9782() throws Exception {
     116    public void testTicket9782() throws ParseException {
    105117        final MapCSSTagChecker test = buildTagChecker("*[/.+_name/][!name] {" +
    106118                "throwWarning: tr(\"has {0} but not {1}\", \"{0.key}\", \"{1.key}\");}");
     
    112124    }
    113125
     126    /**
     127     * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/10859">Bug #10859</a>.
     128     * @throws ParseException if a parsing error occurs
     129     */
    114130    @Test
    115     public void testTicket10859() throws Exception {
     131    public void testTicket10859() throws ParseException {
    116132        final MapCSSTagChecker test = buildTagChecker("way[highway=footway][foot?!] {\n" +
    117133                "  throwWarning: tr(\"{0} used with {1}\", \"{0.value}\", \"{1.tag}\");}");
     
    123139    }
    124140
     141    /**
     142     * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/13630">Bug #13630</a>.
     143     * @throws ParseException if a parsing error occurs
     144     */
    125145    @Test
    126     public void testPreprocessing() throws Exception {
     146    public void testTicket13630() throws ParseException {
     147        ParseResult result = MapCSSTagChecker.TagCheck.readMapCSS(new StringReader(
     148                "node[crossing=zebra] {fixRemove: \"crossing=zebra\";}"));
     149        assertTrue(result.parseChecks.isEmpty());
     150        assertEquals(1, result.parseErrors.size());
     151    }
     152
     153    @Test
     154    public void testPreprocessing() throws ParseException {
    127155        final MapCSSTagChecker test = buildTagChecker("" +
    128156                "@supports (min-josm-version: 1) { *[foo] { throwWarning: \"!\"; } }\n" +
Note: See TracChangeset for help on using the changeset viewer.