Ignore:
Timestamp:
2020-04-11T17:37:01+02:00 (5 years ago)
Author:
simon04
Message:

fix #19070 - SearchCompiler: regexp comparison using <tilde>

File:
1 edited

Legend:

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

    r14561 r16260  
    142142
    143143    /**
     144     * Search by regular expression: key~value.
     145     * @throws SearchParseError if an error has been encountered while compiling
     146     */
     147    @Test
     148    public void testRegexp() throws SearchParseError {
     149        final SearchCompiler.Match c = SearchCompiler.compile("foo~[Bb]a[rz]");
     150        assertFalse(c.match(newPrimitive("foobar", "true")));
     151        assertFalse(c.match(newPrimitive("foo", "foo")));
     152        assertTrue(c.match(newPrimitive("foo", "bar")));
     153        assertTrue(c.match(newPrimitive("foo", "baz")));
     154        assertTrue(c.match(newPrimitive("foo", "Baz")));
     155        assertEquals("foo=[Bb]a[rz]", c.toString());
     156    }
     157
     158    /**
    144159     * Search by comparison.
    145160     * @throws SearchParseError if an error has been encountered while compiling
Note: See TracChangeset for help on using the changeset viewer.