Ticket #18577: 18577-v2.patch

File 18577-v2.patch, 3.4 KB (added by simon04, 4 years ago)
  • src/org/openstreetmap/josm/data/validation/tests/OpeningHourTest.java

    commit a85b8920aa9f0ee52cf89c21d5aad0ace4a067e9
    Author: Simon Legner <Simon.Legner@gmail.com>
    Date:   2020-01-19 09:26:34 +0100
    
        fix #18577 - Update opening_hours.js
    
    diff --git a/src/org/openstreetmap/josm/data/validation/tests/OpeningHourTest.java b/src/org/openstreetmap/josm/data/validation/tests/OpeningHourTest.java
    index ba657cdf4..26b3d6e25 100644
    a b public void initialize() throws Exception {  
    5656                 Reader reader = cf.getContentReader()) {
    5757                ENGINE.eval("var console={};console.debug=print;console.log=print;console.warn=print;console.error=print;");
    5858                ENGINE.eval(reader);
    59                 ENGINE.eval("var opening_hours = require('opening_hours');");
    6059                // fake country/state to not get errors on holidays
    61                 ENGINE.eval("var nominatimJSON = {address: {state: 'Bayern', country_code: 'de'}};");
     60                ENGINE.eval("var nominatimJSON = {address: {country_code: 'xa'}};");
    6261                ENGINE.eval(
    6362                        "var oh = function (value, tag_key, mode, locale) {" +
    6463                        " try {" +
    65                         "    var conf = {tag_key: tag_key, locale: locale};" +
     64                        "    var conf = {tag_key: tag_key, locale: locale, additional_rule_separator: false};" +
    6665                        "    if (mode > -1) {" +
    6766                        "      conf.mode = mode;" +
    6867                        "    }" +
  • test/unit/org/openstreetmap/josm/data/validation/tests/OpeningHourTestTest.java

    diff --git a/test/unit/org/openstreetmap/josm/data/validation/tests/OpeningHourTestTest.java b/test/unit/org/openstreetmap/josm/data/validation/tests/OpeningHourTestTest.java
    index bf4a56c84..4a6b74b35 100644
    a b public void testCheckOpeningHourSyntax2() {  
    9191        final String key = "opening_hours";
    9292        final List<OpeningHourTest.OpeningHoursTestError> errors = openingHourTest.checkOpeningHourSyntax(key, "Mo-Tue");
    9393        assertThat(errors, hasSize(2));
    94         assertEquals(key + " - Mo-Tue <--- (Please use the abbreviation \"Tu\" for \"tue\".)", errors.get(0).getMessage());
     94        assertEquals(key + " - Mo-Tue <--- (Please use the English abbreviation \"Tu\" for \"tue\".)", errors.get(0).getMessage());
    9595        assertEquals(Severity.WARNING, errors.get(0).getSeverity());
    9696        assertEquals(key +
    9797                " - Mo-Tue <--- (This rule is not very explicit because there is no time selector being used."+
     98                " A time selector is the part specifying hours when the object is opened, for example \"10:00-19:00\"."+
    9899                " Please add a time selector to this rule or use a comment to make it more explicit.)", errors.get(1).getMessage());
    99100        assertEquals(Severity.WARNING, errors.get(1).getSeverity());
    100101    }
    public void testPresetValues() {  
    242243    public void testTicket17932() {
    243244        Logging.clearLastErrorAndWarnings();
    244245        assertTrue(openingHourTest.checkOpeningHourSyntax("opening_hours", "SH off").isEmpty());
    245         List<String> errors = Logging.getLastErrorAndWarnings();
    246         assertFalse(errors.isEmpty());
    247         assertTrue(errors.get(0), errors.get(0).contains("no SH definition"));
    248246    }
    249247}