Changeset 17746 in josm for trunk/test/unit


Ignore:
Timestamp:
2021-04-11T13:09:44+02:00 (3 years ago)
Author:
simon04
Message:

fix #16171 - Case sensitive regexp key=value searches aren't case sensitive

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/data/osm/search/SearchCompilerTest.java

    r17277 r17746  
    147147
    148148    /**
     149     * Search by case-sensitive regular expression.
     150     * @throws SearchParseError if an error has been encountered while compiling
     151     */
     152    @Test
     153    void testRegexpCaseSensitive() throws Exception {
     154        SearchSetting searchSetting = new SearchSetting();
     155        searchSetting.regexSearch = true;
     156        searchSetting.text = "foo=\"^bar$\"";
     157        assertTrue(SearchCompiler.compile(searchSetting).match(OsmUtils.createPrimitive("node foo=bar")));
     158        assertTrue(SearchCompiler.compile(searchSetting).match(OsmUtils.createPrimitive("node foo=BAR")));
     159        searchSetting.caseSensitive = true;
     160        assertTrue(SearchCompiler.compile(searchSetting).match(OsmUtils.createPrimitive("node foo=bar")));
     161        assertFalse(SearchCompiler.compile(searchSetting).match(OsmUtils.createPrimitive("node foo=BAR")));
     162    }
     163
     164    /**
    149165     * Search by comparison.
    150166     * @throws SearchParseError if an error has been encountered while compiling
Note: See TracChangeset for help on using the changeset viewer.