- Delete NativeLevelFixtures.kt and make native repository setup an optional property of each Level. - Move every existing native setup into its corresponding level file so setup, validation, and tests stay together. - Add the missing Blame native setup with config.rb history and a Spider Man password commit. - Add a native runtime regression that verifies `git blame config.rb` identifies Spider Man on the password line. - Verify the full JVM test suite using the compiled host Git runtime.
38 lines
1.6 KiB
Kotlin
38 lines
1.6 KiB
Kotlin
package solutions.tretter.githugandroid
|
|
|
|
/**
|
|
* Port of the upstream ruby-githug `rebase` 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 rebaseLevel(): Level = level(
|
|
id = "rebase",
|
|
title = "Rebase",
|
|
description = "We are using a git rebase workflow and the feature branch is ready to go into master. Let's rebase the feature branch onto our master branch.",
|
|
hints = listOf("You want to research the `git rebase` command"),
|
|
commandSuggestions = listOf("git checkout feature", "git rebase master"),
|
|
setup = { RepoState(initialized = true, headBranch = "master", branches = mapOf("master" to 2, "feature" to 2)) },
|
|
nativeSetup = {
|
|
resetFiles()
|
|
write("README", "readme\n")
|
|
addCommit("init commit", "README")
|
|
checkoutNew("feature")
|
|
write("feature", "feature\n")
|
|
addCommit("add feature", "feature")
|
|
checkout("master")
|
|
append("README", "content\n")
|
|
addCommit("add content", "README")
|
|
true
|
|
},
|
|
validator = repoPredicate { repo ->
|
|
repo.headBranch == "feature" &&
|
|
repo.commits.take(3).map { it.message } == listOf("add feature", "add content", "init commit")
|
|
},
|
|
testCases = listOf(
|
|
levelTestCase("checkout feature then rebase", "git checkout feature", "git rebase master"),
|
|
levelTestCase("rebase named branch", "git rebase master feature"),
|
|
),
|
|
)
|