Misc Changes

This commit is contained in:
Joe Tretter
2026-05-06 21:28:44 -05:00
parent 5727022baf
commit e1b2d7f7a1
64 changed files with 1662 additions and 300 deletions

View File

@@ -0,0 +1,22 @@
package solutions.tretter.githugandroid
/**
* Port of the upstream ruby-githug `branch_at` 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 branchAtLevel(): Level = level(
id = "branch_at",
title = "Branch At",
description = "You forgot to branch at the previous commit and made a commit on top of it. Create the branch test_branch at the commit before the last.",
hints = listOf("Just like creating a branch, but you have to pass an extra argument."),
commandSuggestions = listOf("git branch test_branch HEAD~1"),
setup = { RepoState(initialized = true, commits = listOf(CommitNode("1", "Adding file1"), CommitNode("2", "Updating file1"), CommitNode("3", "Updating file1 again")), branches = mapOf("master" to 3)) },
validator = repoPredicate { repo -> repo.branches["test_branch"] == 2 },
testCases = listOf(
levelTestCase("branch at previous commit", "git branch test_branch HEAD~1"),
levelTestCase("branch at caret", "git branch test_branch HEAD^"),
),
)