Files
Githug-Android/app/src/main/java/solutions/tretter/githugandroid/levels/CommitInFutureLevel.kt
Joe Tretter e1b2d7f7a1 Misc Changes
2026-05-06 21:28:44 -05:00

22 lines
1.0 KiB
Kotlin

package solutions.tretter.githugandroid
/**
* Port of the upstream ruby-githug `commit_in_future` 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 commitInFutureLevel(): Level = level(
id = "commit_in_future",
title = "Commit In Future",
description = "Commit your changes with the future date (e.g. tomorrow).",
hints = listOf("Build a time format, and commit your code using --date parameter."),
commandSuggestions = listOf("git commit --date tomorrow -m \"Future commit\""),
setup = { RepoState(initialized = true, files = listOf(GitFile("README", staged = true)), branches = mapOf("master" to 0)) },
validator = repoPredicate { repo -> repo.commits.isNotEmpty() },
testCases = listOf(
levelTestCase("commit with date option", "git commit --date tomorrow -m \"Future commit\""),
),
)