Ignore:
Timestamp:
2016-03-05T17:57:04+01:00 (6 years ago)
Author:
simon04
Message:

see #8460 - fix typo from r9931, fix matching, improve conditions, add unit test

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/RelationCheckerTest.groovy

    r8863 r9932  
    118118        assert errors.get(0).getDescription() == "Role member does not match expression power in template Power Route"
    119119    }
     120
     121    void testRouteMemberExpression() {
     122        def r = createRelation("type=route route=tram public_transport:version=2")
     123        r.addMember(new RelationMember("", createPrimitive("way railway=tram")))
     124        r.addMember(new RelationMember("stop", createPrimitive("node public_transport=stop_position tram=yes")))
     125        r.addMember(new RelationMember("platform", createPrimitive("node public_transport=platform tram=yes")))
     126        assert testRelation(r).size() == 0
     127
     128        r.addMember(new RelationMember("", createPrimitive("way no-rail-way=yes")))
     129        assert testRelation(r).size() == 1
     130        assert testRelation(r).get(0).getDescription() == "Role member does not match expression railway in template Public Transport Route (Rail)"
     131
     132        r.removeMember(3)
     133        r.addMember(new RelationMember("stop", createPrimitive("way no-rail-way=yes")))
     134        assert testRelation(r).size() == 1
     135        assert testRelation(r).get(0).getDescription() == "Role member type way does not match accepted list of node in template Public Transport Route (Rail)"
     136
     137        r.removeMember(3)
     138        r.addMember(new RelationMember("stop", createPrimitive("node public_transport=stop_position bus=yes")))
     139        assert testRelation(r).size() == 1
     140        assert testRelation(r).get(0).getDescription() == "Role member does not match expression public_transport=stop_position && (train=yes || subway=yes || monorail=yes || tram=yes || light_rail=yes) in template Public Transport Route (Rail)"
     141    }
    120142}
Note: See TracChangeset for help on using the changeset viewer.