Changeset 19571 in josm for trunk/test/unit/org
- Timestamp:
- 2026-05-07T15:11:23+02:00 (17 hours ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm
- Files:
-
- 2 edited
-
io/remotecontrol/AddTagsDialogTest.java (modified) (1 diff)
-
tools/TextTagParserTest.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/AddTagsDialogTest.java
r19519 r19571 24 24 assertEquals("Dresden Castle", strings.get("name:en")); 25 25 } 26 27 /** 28 * Unit test for issue #14490 "Support for escaping pipe character in remote control addtags parameters" 29 * A single URL section (value of addtags=...) with a single escaped pipe sysmbol 30 */ 31 @Test 32 void testParseUrlTagsToKeyValues_OneKeyValuePair_OneEscapedPipe() { 33 Map<String, String> strings = AddTagsDialog.parseUrlTagsToKeyValues("gtfs:route_id=de:mvv-muenchen:19-210\\|210"); 34 assertEquals(1, strings.size()); 35 assertEquals("de:mvv-muenchen:19-210|210", strings.get("gtfs:route_id")); 36 } 37 38 /** 39 * Unit test for issue #14490 "Support for escaping pipe character in remote control addtags parameters" 40 * A single URL section (value of addtags=...) with two escaped pipe sysmbols 41 */ 42 @Test 43 void testParseUrlTagsToKeyValues_OneKeyValuePair_TwoEscapedPipe() { 44 Map<String, String> strings = AddTagsDialog.parseUrlTagsToKeyValues("gtfs:route_id=de:mvv-muenchen:19-210\\|210\\|RegionalBus:1179_3"); 45 assertEquals(1, strings.size()); 46 assertEquals("de:mvv-muenchen:19-210|210|RegionalBus:1179_3", strings.get("gtfs:route_id")); 47 } 48 49 /** 50 * Unit test for issue #14490 "Support for escaping pipe character in remote control addtags parameters" 51 * Two URL sections (values of addtags=...) with two escaped pipe sysmbols each 52 */ 53 @Test 54 void testParseUrlTagsToKeyValues_TwoKeyValuePairs_FourEscapedPipe() { 55 Map<String, String> strings = AddTagsDialog.parseUrlTagsToKeyValues("gtfs:route_id=de:mvv-muenchen:19-210\\|210\\|" 56 + "RegionalBus:1179_3|gtfs:trip_id:sample=de:mvv-muenchen:19-210\\|210\\|RegionalBus:1179-1-1-H-0-We#3-320-333"); 57 assertEquals(2, strings.size()); 58 assertEquals("de:mvv-muenchen:19-210|210|RegionalBus:1179_3", strings.get("gtfs:route_id")); 59 assertEquals("de:mvv-muenchen:19-210|210|RegionalBus:1179-1-1-H-0-We#3-320-333", strings.get("gtfs:trip_id:sample")); 60 } 61 62 /** 63 * Unit test for issue #14490 "Support for escaping pipe character in remote control addtags parameters" 64 * Two URL sections (values of addtags=...) with four unescaped pipe sysmbols in the value parts 65 * Same as the test above, but without escapeing the pipe symbols 66 * This is how it worked before the patch, even if the pipe symbols would have been escaped 67 */ 68 @Test 69 void testParseUrlTagsToKeyValues_PipeInValue_NoEscapedPipe() { 70 Map<String, String> strings = AddTagsDialog.parseUrlTagsToKeyValues("gtfs:route_id=de:mvv-muenchen:19-210|210|" 71 + "RegionalBus:1179_3|gtfs:trip_id:sample=de:mvv-muenchen:19-210|210|RegionalBus:1179-1-1-H-0-We#3-320-333"); 72 assertEquals(0, strings.size()); 73 } 26 74 } -
trunk/test/unit/org/openstreetmap/josm/tools/TextTagParserTest.java
r18037 r19571 176 176 List<String> expected = Arrays.asList("foo4", "foo3", "foo2", "foo1"); 177 177 ArrayList<String> actual = new ArrayList<>(TextTagParser.readTagsByRegexp( 178 "foo4=bar4 foo3=bar3 foo2=bar2 foo1=bar1", " ", "(.*?)=(.*?)", true).keySet()); 178 "foo4=bar4 foo3=bar3 foo2=bar2 foo1=bar1", " ", "(.*?)=(.*?)", true, false).keySet()); 179 179 assertEquals(expected, actual); 180 180 }
Note:
See TracChangeset
for help on using the changeset viewer.
