Move native level setups into level files

- 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.
This commit is contained in:
Joe Tretter
2026-05-07 18:53:18 -05:00
parent 7bfb761068
commit 64743ff4a9
30 changed files with 580 additions and 505 deletions

View File

@@ -1,5 +1,7 @@
package solutions.tretter.githugandroid
import java.io.File
/**
* Port of the upstream ruby-githug `fetch` level.
*
@@ -14,6 +16,22 @@ internal fun fetchLevel(): Level = level(
hints = listOf("Look up the 'git fetch' command"),
commandSuggestions = listOf("git fetch origin"),
setup = { RepoState(initialized = true, branches = mapOf("master" to 1), remotes = mapOf("origin" to "remote")) },
nativeSetup = {
resetFiles()
write("master_file")
addCommit("Commits master_file", "master_file")
val remote = siblingRepo("origin")
git("remote", "add", "fetch-setup-origin", File(remote, ".git").absolutePath)
git("push", "fetch-setup-origin", "master")
git("remote", "remove", "fetch-setup-origin")
git(remote, "checkout", "-f", "master")
git(remote, "checkout", "-b", "new_branch")
writeIn(remote, "file1")
addCommitIn(remote, "Commits file 1", "file1")
git("remote", "add", "origin", File(remote, ".git").absolutePath)
git("branch", "--set-upstream-to=origin/master", "master")
true
},
validator = repoPredicate { repo -> "origin/new_branch" in repo.fetchedBranches && repo.headBranch == "master" },
testCases = listOf(
levelTestCase("fetch origin", "git fetch origin"),