Skip to content

Commit

Permalink
chore: Rename content state variables
Browse files Browse the repository at this point in the history
  • Loading branch information
guicamest committed Dec 23, 2023
1 parent 90876e9 commit 17546fc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class CoroutinesFindDuplicatesExecution(
private fun groupFilesByContent(stateHolder: FindProgressStateHolder) {
val filesWithHashes =
with(stateHolder.stateAs<ContentFilterExecutionState>()) {
processedFiles + collectHashes(stateHolder, groupsToProcess)
processedFiles + collectHashes(stateHolder, filesToProcess)
}

val destination =
Expand Down Expand Up @@ -138,7 +138,7 @@ class CoroutinesFindDuplicatesExecution(
)
stateHolder.update { currentState: ContentFilterExecutionStateImpl ->
currentState.copy(
groupsToProcess = currentState.groupsToProcess - pwa,
filesToProcess = currentState.filesToProcess - pwa,
processedFiles = currentState.processedFiles + pathWithAttributesAndContent,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ data class SizeFilterExecutionStateImpl(
) : SizeFilterExecutionState

interface ContentFilterExecutionState : FindDuplicatesExecutionState {
val groupsToProcess: Set<PathWithAttributes>
val filesToProcess: Set<PathWithAttributes>
val processedFiles: Set<PathWithAttributesAndContent>
}

data class ContentFilterExecutionStateImpl(
override val groupsToProcess: Set<PathWithAttributes>,
override val filesToProcess: Set<PathWithAttributes>,
override val processedFiles: Set<PathWithAttributesAndContent>,
) : ContentFilterExecutionState

Expand Down Expand Up @@ -85,7 +85,7 @@ internal fun FindProgressStateHolder.updateStateToSizeFilter() =
internal fun FindProgressStateHolder.updateStateToContentFilter() =
update { currentState: SizeFilterExecutionState ->
ContentFilterExecutionStateImpl(
groupsToProcess = currentState.processedFiles,
filesToProcess = currentState.processedFiles,
processedFiles = emptySet(),
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -258,15 +258,15 @@ class StopResumeTest {

@Test
fun checkFirstState() {
assertThat(contentStates[0].groupsToProcess.map { it.path })
assertThat(contentStates[0].filesToProcess.map { it.path })
.withPathComparator()
.containsExactlyInAnyOrderElementsOf(paths)
assertThat(contentStates[0].processedFiles).isEmpty()
}

@Test
fun checkSecondState() {
val leftToProcess = contentStates[1].groupsToProcess.map { it.path }
val leftToProcess = contentStates[1].filesToProcess.map { it.path }
assertThat(leftToProcess)
.withPathComparator()
.containsAnyElementsOf(paths)
Expand All @@ -279,7 +279,7 @@ class StopResumeTest {

@Test
fun checkThirdSecondState() {
assertThat(contentStates[2].groupsToProcess).isEmpty()
assertThat(contentStates[2].filesToProcess).isEmpty()
assertThat(contentStates[2].processedFiles.map { it.path })
.withPathComparator()
.containsExactlyInAnyOrderElementsOf(paths)
Expand Down

0 comments on commit 17546fc

Please sign in to comment.