ra1028 / DifferenceKit

💻 A fast and flexible O(n) difference algorithm framework for Swift collection.

Home Page:https://ra1028.github.io/DifferenceKit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing Deletions

kylerobson opened this issue · comments

Checklist

Expected Behavior

My StagedChangeset's stages should contain a deletion of indexes: [1]

Current Behavior

My StagedChangeset's stages contains deletions of [] for all stages.

Steps to Reproduce

        // MockItem uses:
        // Just `diffID` comparison for `differenceIdentifier`.
        // Just `content` comparison for `isContentEqual`.
        // Both `diffID` and `content` comparison for `==` `Equatable` implementation of `MockItem`.

        let mock1a = MockItem(diffID: 1, content: "a")  
        let mock2 = MockItem(diffID: 2, content: "a")  
        let mock3a = MockItem(diffID: 3, content: "a")
        let mock3b = MockItem(diffID: 3, content: "b")  
        let mock4 = MockItem(diffID: 4, content: "a")
        
        let first = [mock1a, mock2, mock3a]
        let second = [mock3b, mock1a, mock4]

Expect changes to contain three changes:

  1. Updates: [2]. Should transform [mock1a, mock2, mock3a] to [mock1a, mock2, mock3b].
  2. Deletes: [1]. Should transform [mock1a, mock2, mock3b] to [mock1a, mock3b].
  3. Inserts and Moves. Inserts: [2]. Moves: (0, 1) or (1, 0). Should transform [mock1a, mock3b] to [mock3b, mock1a, mock4].

Actual Deletes is [] instead of [1] during step (2).

Environments

  • Library version: Master

  • Swift version: 4.2

  • iOS version: 12

  • Xcode version: 10.1

  • Devices/Simulators: DifferenceKit, "My Mac", CMD+U

  • CocoaPods/Carthage version: N/A

@kylerobson
Was this ok to close?