- Require the Rm level to stage or remove the tracked deleted file instead of treating the initial deleted worktree state as solved. - Add a regression test proving read-only commands such as `ls` do not complete the Rm level. - Verify the full JVM level solution suite with the compiled host Git runtime.
25 lines
1.1 KiB
Kotlin
25 lines
1.1 KiB
Kotlin
package solutions.tretter.githugandroid
|
|
|
|
/**
|
|
* Port of the upstream ruby-githug `rm` level.
|
|
*
|
|
* Setup documents the repository shape the learner explores. Evaluation is kept
|
|
* state-based whenever the exercise changes repository objects; answer-only
|
|
* levels intentionally validate the answer entered at the prompt.
|
|
*/
|
|
internal fun rmLevel(): Level = level(
|
|
id = "rm",
|
|
title = "Rm",
|
|
description = "A file has been removed from the working tree, but not from the repository. Identify this file and remove it.",
|
|
hints = emptyList(),
|
|
commandSuggestions = listOf("git status", "git rm deleteme.rb"),
|
|
setup = { RepoState(initialized = true, files = listOf(GitFile("deleteme.rb", tracked = true, deleted = true)), commits = listOf(CommitNode("0000001", "Added a temp file")), branches = mapOf("master" to 1)) },
|
|
validator = repoPredicate { repo ->
|
|
repo.files.none { it.name == "deleteme.rb" } ||
|
|
repo.files.any { it.name == "deleteme.rb" && it.deleted && it.staged }
|
|
},
|
|
testCases = listOf(
|
|
levelTestCase("git rm deleted path", "git rm deleteme.rb"),
|
|
),
|
|
)
|