package solutions.tretter.githugandroid /** * Port of the upstream ruby-githug `merge` 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 mergeLevel(): Level = level( id = "merge", title = "Merge", description = "We have a file in the branch 'feature'. Let's merge it with the master branch.", hints = listOf("You want to research the `git merge` command."), commandSuggestions = listOf("git merge feature"), setup = { RepoState(initialized = true, files = listOf(GitFile("file1", tracked = true)), branches = mapOf("master" to 1, "feature" to 2)) }, nativeSetup = { resetFiles() write("file1") addCommit("added file1", "file1") checkoutNew("feature") write("file2") addCommit("added file2", "file2") checkout("master") true }, validator = repoPredicate { repo -> repo.headBranch == "master" && repo.files.any { it.name == "file2" && it.tracked } }, testCases = listOf( levelTestCase("merge feature", "git merge feature"), levelTestCase("merge feature with explicit merge commit", "git merge --no-ff feature -m \"Merge feature\""), ), negativeTestCases = listOf( levelTestCase("switching to feature does not solve", "git switch feature"), ), )