added () to config variant trimming character set (#1078)

* added () to config variant trimming character set

* added test cases

* added test cases and changelog entry

* Update CHANGELOG.md

removed

Co-authored-by: Yonas Kolb <yonaskolb@users.noreply.github.com>

* fixed incorrect test case

Co-authored-by: Yonas Kolb <yonaskolb@users.noreply.github.com>
This commit is contained in:
David Lee
2021-05-16 02:12:04 -05:00
committed by GitHub
parent dc8544f346
commit b6d87a1cc6
3 changed files with 7 additions and 1 deletions
+3
View File
@@ -2,6 +2,9 @@
## Next Version
#### Fixed
- Added `()` to config variant trimming charater set to fix scheme config variant lookups for some configs like `Debug (Development)` that broke in 2.22.0 [#1078](https://github.com/yonaskolb/XcodeGen/pull/1078) @DavidWoohyunLee
## 2.22.0
#### Added
+1 -1
View File
@@ -28,7 +28,7 @@ extension Config {
guard self.type == type else { return false }
let nameWithoutType = self.name.lowercased()
.replacingOccurrences(of: type.name.lowercased(), with: "")
.trimmingCharacters(in: CharacterSet(charactersIn: " -_"))
.trimmingCharacters(in: CharacterSet(charactersIn: " -_()"))
return nameWithoutType == variant.lowercased()
}
}
@@ -359,6 +359,9 @@ class ProjectSpecTests: XCTestCase {
try expectVariant("Dev", for: Config(name: "Dev_debug", type: .debug), matches: true)
try expectVariant("Prod", for: Config(name: "PreProd debug", type: .debug), matches: false)
try expectVariant("Develop", for: Config(name: "Dev debug", type: .debug), matches: false)
try expectVariant("Development", for: Config(name: "Debug (Development)", type: .debug), matches: true)
try expectVariant("Staging", for: Config(name: "Debug (Staging)", type: .debug), matches: true)
try expectVariant("Production", for: Config(name: "Debug (Production)", type: .debug), matches: true)
}
}
}