UnitTests // Sync changes from LMAssociates.

This commit is contained in:
ShikiSuen 2022-07-22 11:52:07 +08:00
parent 9402c36bf9
commit f03a641882
1 changed files with 6 additions and 4 deletions

View File

@ -357,13 +357,15 @@ extension String {
extension vChewing.LMAssociates {
public mutating func forceOpenStringInstead(_ strData: String) {
strData.ranges(splitBy: "\n").forEach {
strData.ranges(splitBy: "\n").filter({ !$0.isEmpty }).forEach {
let neta = strData[$0].split(separator: " ")
if neta.count >= 2 {
let theKey = String(neta[0])
if !neta[0].isEmpty, !neta[1].isEmpty, theKey.first != "#" {
let theValue = $0
rangeMap[theKey, default: []].append(theValue)
if !theKey.isEmpty, theKey.first != "#" {
for (i, _) in neta.filter({ $0.first != "#" && !$0.isEmpty }).enumerated() {
if i == 0 { continue }
rangeMap[theKey, default: []].append(($0, i))
}
}
}
}