Catch also square brackets in approximate comparsion (#641)

This commit is contained in:
Rafał Mikrut 2022-02-27 14:35:44 +01:00 committed by GitHub
parent 3ce5d4a967
commit 91a9e56114
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -902,10 +902,10 @@ fn get_approximate_conversion(what: &mut String) {
let mut space_before = true;
for character in what.chars() {
match character {
'(' => {
'(' | '[' => {
tab_number += 1;
}
')' => {
')' | ']' => {
if tab_number == 0 {
// Nothing to do, not even save it to output
} else {
@ -956,5 +956,9 @@ mod tests {
let mut what = " fsf.f. ".to_string();
get_approximate_conversion(&mut what);
assert_eq!(what, "fsf f");
let mut what = "Kekistan (feat. roman) [Mix on Mix]".to_string();
get_approximate_conversion(&mut what);
assert_eq!(what, "Kekistan");
}
}