mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-29 01:13:53 +03:00
Fix a bug incorrectly abbreviating road names, found in Bristol
This commit is contained in:
parent
aed6795234
commit
83600f0e26
@ -170,12 +170,12 @@ fn simplify_patterns() -> Vec<(Regex, String)> {
|
||||
] {
|
||||
// Only replace directions at the start or end of the string
|
||||
replace.push((
|
||||
Regex::new(&format!("^{}", long)).unwrap(),
|
||||
short.to_string(),
|
||||
Regex::new(&format!("^{long} ")).unwrap(),
|
||||
format!("{short} "),
|
||||
));
|
||||
replace.push((
|
||||
Regex::new(&format!("{}$", long)).unwrap(),
|
||||
short.to_string(),
|
||||
Regex::new(&format!(" {long}$")).unwrap(),
|
||||
format!(" {short}"),
|
||||
));
|
||||
}
|
||||
|
||||
@ -209,6 +209,7 @@ mod tests {
|
||||
for (input, want) in [
|
||||
("Northeast Northgate Way", "NE Northgate Way"),
|
||||
("South 42nd Street", "S 42nd St"),
|
||||
("Northcote Road", "Northcote Road"),
|
||||
] {
|
||||
let got = simplify_name(input.to_string()).unwrap();
|
||||
if got != want {
|
||||
|
Loading…
Reference in New Issue
Block a user