Ignore:
Timestamp:
2014-02-17T19:21:41+01:00 (6 years ago)
Author:
simon04
Message:

see #9593 - MapCSS: adapt MapCSS tests to negated regular expressions behaviour (see r6859)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/data/validator/numeric.mapcss

    r6769 r6861  
    1515}
    1616
    17 *[layer !~ /^0$|^(-|\+)?[1-5]$/] {
     17*[layer][layer !~ /^0$|^(-|\+)?[1-5]$/] {
    1818  throwWarning: tr("layer should be between -5 and 5");
    1919  assertMatch: "node layer=-50";
     
    2626}
    2727
    28 *[level !~ /^((([0-9]|-[1-9])|[1-9][0-9]*)(\.5)?)(;(([0-9]|-[1-9])|[1-9][0-9]*)(\.5)?)*$|^-0\.5$/] {
     28*[level][level !~ /^((([0-9]|-[1-9])|[1-9][0-9]*)(\.5)?)(;(([0-9]|-[1-9])|[1-9][0-9]*)(\.5)?)*$|^-0\.5$/] {
    2929  throwWarning: tr("level should be numbers with optional .5 increments");
    3030  assertMatch: "node level=one";
     
    3636}
    3737
    38 *[height !~ /^(([0-9]+\.?[0-9]*( (m|ft))?)|([1-9][0-9]*\'((10|11|[0-9])((\.[0-9]+)?)\")?))$/] {
     38*[height][height !~ /^(([0-9]+\.?[0-9]*( (m|ft))?)|([1-9][0-9]*\'((10|11|[0-9])((\.[0-9]+)?)\")?))$/] {
    3939  throwWarning: tr("{0}: meters is default; period is separator; if units, put space then unit", "height");
    4040  assertMatch: "node height=medium";
     
    4747}
    4848
    49 *[maxheight !~ /^(([1-9][0-9]*(\.[0-9]+)?( (m|ft))?)|([0-9]+\'(([0-9]|10|11)(\.[0-9]*)?\")?))$/] {
     49*[maxheight][maxheight !~ /^(([1-9][0-9]*(\.[0-9]+)?( (m|ft))?)|([0-9]+\'(([0-9]|10|11)(\.[0-9]*)?\")?))$/] {
    5050  throwWarning: tr("{0}: meters is default; period is separator; if units, put space then unit", "maxheight");
    5151  assertMatch: "node maxheight=something";
     
    6060}
    6161
    62 way[width !~ /^(([0-9]+\.?[0-9]*( [a-z]+)?)|([0-9]+\'([0-9]+\.?[0-9]*\")?))$/] {
     62way[width][width !~ /^(([0-9]+\.?[0-9]*( [a-z]+)?)|([0-9]+\'([0-9]+\.?[0-9]*\")?))$/] {
    6363  throwWarning: tr("{0}: meters is default; period is separator; if units, put space then unit", "width");
    6464  assertMatch: "way width=something";
     
    7272}
    7373
    74 *[maxwidth !~ /^(([0-9]+\.?[0-9]*( (m|ft))?)|([0-9]+\'[0-9]+\.?[0-9]*\"))$/] {
     74*[maxwidth][maxwidth !~ /^(([0-9]+\.?[0-9]*( (m|ft))?)|([0-9]+\'[0-9]+\.?[0-9]*\"))$/] {
    7575  throwWarning: tr("{0}: meters is default; period is separator; if units, put space then unit", "maxwidth");
    7676  assertMatch: "way maxwidth=something";
     
    8282}
    8383
    84 way[maxspeed !~ /^(signals|none|unposted|unknown|variable|walk|[1-9][0-9]*( [a-z]+)?|[A-Z][A-Z]:(urban|rural|living_street|motorway))$/] {
     84way[maxspeed][maxspeed !~ /^(signals|none|unposted|unknown|variable|walk|[1-9][0-9]*( [a-z]+)?|[A-Z][A-Z]:(urban|rural|living_street|motorway))$/] {
    8585  throwWarning: tr("unusual {0} format", "maxspeed");
    8686  assertMatch: "way maxspeed=something";
     
    9898}
    9999
    100 way[voltage =~ /(.*[A-Za-z].*)|.*,.*|.*( ).*/] {
     100way[voltage][voltage =~ /(.*[A-Za-z].*)|.*,.*|.*( ).*/] {
    101101  throwWarning: tr("voltage should be in volts with no units/delimiter/spaces");
    102102  assertMatch: "way voltage=medium";
     
    106106/* some users are using frequency for other purposes (not electromagnetic)
    107107   with the values 'perennial' and 'intermittent'; the vast majority are 0, 16.7, 50 and 60 */
    108 way[frequency !~ /^(0|[1-9][0-9]*(\.[0-9]+)?)( (kHz|MHz|GHz|THz))?$/] {
     108way[frequency][frequency !~ /^(0|[1-9][0-9]*(\.[0-9]+)?)( (kHz|MHz|GHz|THz))?$/] {
    109109  throwWarning: tr("unusual {0} specification", "frequency");
    110110  assertMatch: "way frequency=something";
     
    116116}
    117117
    118 way[gauge !~ /^([1-9][0-9]{1,3}(;[1-9][0-9]{1,3})*|broad|standard|narrow)$/] {
     118way[gauge][gauge !~ /^([1-9][0-9]{1,3}(;[1-9][0-9]{1,3})*|broad|standard|narrow)$/] {
    119119  throwWarning: tr("unusual train track gauge; use mm with no separator");
    120120  assertMatch: "way gauge=something";
     
    126126
    127127/* the numbers for percentage and degrees include could probably be bracketed a bit more precisely */
    128 way[incline !~ /^(up|down|-?([0-9]+?(\.[1-9]%)?|100)[%°]?)$/] {
     128way[incline][incline !~ /^(up|down|-?([0-9]+?(\.[1-9]%)?|100)[%°]?)$/] {
    129129  throwWarning: tr("unusual incline; use percentages/degrees or up/down");
    130130  assertMatch: "way incline=extreme";
     
    137137
    138138/* see ticket #9631 */
    139 *[population !~ /^[0-9]+$/ ] {
     139*[population][population !~ /^[0-9]+$/ ] {
    140140  throwWarning: tr("{0} must be a numeric value", "{0.key}");
    141141}
Note: See TracChangeset for help on using the changeset viewer.