You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Environment: Eureka: 62484db, Xcode 11.5 and iOS 13.4.1
Test case:
@testable import Eureka
import Foundation
import XCTest
class SectionTests: XCTestCase {
func testDeletingRows() {
let form = Form()
var section = Section("section_01")
form.append(section)
section.append(NameRow(tag: "row_01"))
section.append(NameRow(tag: "row_02"))
section.removeAll(where: { row in row.tag == "row_01" }) // <-- Thread 1: Assertion failed: Duplicate tag row_02
XCTAssertNotNil(form.rowBy(tag: "row_02"))
}
}
Backtrace:
#0 0x00000001100c4330 in swift_runtime_on_report () #1 0x000000011013e0b3 in swift_stdlib_reportFatalErrorInFile () #2 0x000000010fe0073e in closure #1 in closure #1 in closure #1 in assertionFailure(::file:line🎏) () #3 0x000000010fe00347 in closure #1 in closure #1 in assertionFailure(::file:line🎏) () #4 0x000000010fe00927 in specialized String.withUTF8(:) () #5 0x000000010fdfef4a in assertionFailure(::file:line🎏) () #6 0x000000010f94a7a7 in BaseRow.wasAddedTo(section:) at /Users/bruno/Downloads/Eureka/Source/Core/BaseRow.swift:198 #7 0x000000010f9ae878 in Section.subscript.setter at /Users/bruno/Downloads/Eureka/Source/Core/Section.swift:267 #8 0x000000010f9afa56 in protocol witness for MutableCollection.subscript.setter in conformance Section () #9 0x000000010fdd9364 in MutableCollection.swapAt(::) () #10 0x000000010f9afce2 in protocol witness for MutableCollection.swapAt(::) in conformance Section () #11 0x000000010fe183e0 in MutableCollection._halfStablePartition(isSuffixElement:) () #12 0x000000010fded891 in RangeReplaceableCollection<>.removeAll(where:) () #13 0x000000010f916ad5 in SectionTests.testDeletingRows() at /Users/bruno/Downloads/Eureka/Tests/SectionTests.swift:21 #14 0x000000010f916d7b in @objc SectionTests.testDeletingRows() ()
Log:
Assertion failed: Duplicate tag row_02: file Eureka/Source/Core/BaseRow.swift, line 198
2020-06-08 10:16:09.489302+0200 xctest[4711:94968] Assertion failed: Duplicate tag row_02: file Eureka/Source/Core/BaseRow.swift, line 198
The text was updated successfully, but these errors were encountered:
Thanks for sharing with a test case. I can reproduce this. Seems that something changed in the internal implementation of this method?
Weird also that remove(where:) calls the subscript to replace elements without removing them first.
A possible fix would be to reimplement this method. Any other suggestion?
Test case:
Backtrace:
Log:
The text was updated successfully, but these errors were encountered: