Misc Changes

This commit is contained in:
Joe Tretter
2026-05-11 19:19:51 -05:00
parent 8f829fb969
commit 7e55084815
7 changed files with 46 additions and 9 deletions

View File

@@ -1,6 +1,7 @@
package solutions.tretter.githugandroid
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Test
import java.io.File
@@ -97,6 +98,30 @@ class LevelSolutionsTest {
)
}
@Test
fun reportedRegressionCommandsDoNotSolveLevels() {
val statusRepo = statusLevel().setup()
assertEquals(listOf("database.yml"), statusRepo.files.map { it.name })
val gitBinary = testGitBinary()
val runtimeRoot = testSandboxRoot().apply {
deleteRecursively()
mkdirs()
}
val mergeExercise = mergeLevel()
val mergeRuntime = GitRepositoryRuntime(runtimeRoot, gitBinary)
val mergeRepo = mergeRuntime.prepareLevel(mergeExercise)
val (switchedRepo, _) = mergeRuntime.execute(mergeExercise, mergeRepo, "git switch feature")
assertFalse("Switching to feature must not solve the merge level.", mergeExercise.validator(switchedRepo, "git switch feature"))
val fetchExercise = fetchLevel()
val fetchRuntime = GitRepositoryRuntime(runtimeRoot, gitBinary)
val fetchRepo = fetchRuntime.prepareLevel(fetchExercise)
val (pulledRepo, _) = fetchRuntime.execute(fetchExercise, fetchRepo, "git pull")
assertFalse("Pulling must not solve the fetch level.", fetchExercise.validator(pulledRepo, "git pull"))
}
private companion object {
fun writeEvidenceLog(content: String) {
val repoRoot = File(System.getProperty("user.dir") ?: ".")