mirror of
https://github.com/pointfreeco/swift-composable-architecture.git
synced 2025-12-20 09:11:33 +01:00
Update Format Workflow (#127)
* Update Format Workflow * Update IdentifiedArrayTests.swift
This commit is contained in:
2
.github/workflows/format.yml
vendored
2
.github/workflows/format.yml
vendored
@@ -15,7 +15,7 @@ jobs:
|
||||
run: brew install swift-format
|
||||
- name: Format
|
||||
run: make format
|
||||
- uses: stefanzweifel/git-auto-commit-action@v4.1.6
|
||||
- uses: stefanzweifel/git-auto-commit-action@v4
|
||||
with:
|
||||
commit_message: Run swift-format
|
||||
branch: 'master'
|
||||
|
||||
@@ -238,7 +238,8 @@ where Element: Identifiable, ID == Element.ID {
|
||||
self.init([], id: \.id)
|
||||
}
|
||||
|
||||
public mutating func replaceSubrange<C, R>(_ subrange: R, with newElements: C) where C : Collection, R : RangeExpression, Element == C.Element, Index == R.Bound {
|
||||
public mutating func replaceSubrange<C, R>(_ subrange: R, with newElements: C)
|
||||
where C: Collection, R: RangeExpression, Element == C.Element, Index == R.Bound {
|
||||
let replacingIds = self.ids[subrange]
|
||||
let newIds = newElements.map { $0.id }
|
||||
ids.replaceSubrange(subrange, with: newIds)
|
||||
|
||||
@@ -133,14 +133,20 @@ final class IdentifiedArrayTests: XCTestCase {
|
||||
User(id: 2, name: "Blob Jr."),
|
||||
]
|
||||
|
||||
array.replaceSubrange(0...1, with: [
|
||||
User(id: 4, name: "Flob IV"),
|
||||
User(id: 5, name: "Flob V")
|
||||
])
|
||||
array.replaceSubrange(
|
||||
0...1,
|
||||
with: [
|
||||
User(id: 4, name: "Flob IV"),
|
||||
User(id: 5, name: "Flob V"),
|
||||
]
|
||||
)
|
||||
|
||||
XCTAssertEqual(
|
||||
array,
|
||||
[User(id: 4, name: "Flob IV"), User(id: 5, name: "Flob V"), User(id: 1, name: "Blob"), User(id: 2, name: "Blob Jr.")]
|
||||
[
|
||||
User(id: 4, name: "Flob IV"), User(id: 5, name: "Flob V"), User(id: 1, name: "Blob"),
|
||||
User(id: 2, name: "Blob Jr."),
|
||||
]
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user