Changeset 6647 in josm for trunk


Ignore:
Timestamp:
2014-01-06T18:42:37+01:00 (11 years ago)
Author:
simon04
Message:

see #8519 - Lanes validator: correctly handle consecutive |s (e.g., yes|| defines 3 lanes)

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/validation/tests/Lanes.java

    r6606 r6647  
    3131
    3232    static int getLanesCount(String value) {
    33         return value.isEmpty() ? 0 : value.split("\\|").length;
     33        return value.isEmpty() ? 0 : value.replaceAll("[^|]", "").length() + 1;
    3434    }
    3535
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/LanesTest.groovy

    r6606 r6647  
    1818        assert lanes.getLanesCount("left|right") == 2
    1919        assert lanes.getLanesCount("yes|no|yes") == 3
     20        assert lanes.getLanesCount("yes||") == 3
    2021    }
    2122
     
    5455        assert lanes.errors.get(0).getMessage() == "Number of lanes:forward+lanes:backward greater than lanes"
    5556    }
     57
     58    void test8() {
     59        lanes.check(TestUtils.createPrimitive("way destination:country:lanes=X|Y;Z|none destination:ref:lanes=xyz|| destination:sign:lanes=none|airport|none"))
     60        assert lanes.errors.isEmpty()
     61    }
    5662}
Note: See TracChangeset for help on using the changeset viewer.