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:
@@ -1,5 +1,7 @@
|
||||
package solutions.tretter.githugandroid
|
||||
|
||||
import java.io.File
|
||||
|
||||
/**
|
||||
* Port of the upstream ruby-githug `push_branch` level.
|
||||
*
|
||||
@@ -14,6 +16,28 @@ internal fun pushBranchLevel(): Level = level(
|
||||
hints = listOf("Investigate the options in `git push` using `git push --help`"),
|
||||
commandSuggestions = listOf("git push origin test_branch"),
|
||||
setup = { RepoState(initialized = true, branches = mapOf("master" to 2, "other_branch" to 3, "test_branch" to 4), remotes = mapOf("origin" to "remote"), headBranch = "master") },
|
||||
nativeSetup = {
|
||||
resetFiles()
|
||||
write("file1")
|
||||
addCommit("committed changes on master", "file1")
|
||||
val remote = siblingRepo("origin")
|
||||
git("remote", "add", "push-branch-setup-origin", File(remote, ".git").absolutePath)
|
||||
git("push", "push-branch-setup-origin", "master")
|
||||
git("remote", "remove", "push-branch-setup-origin")
|
||||
git(remote, "checkout", "-f", "master")
|
||||
write("file2")
|
||||
addCommit("If this commit gets pushed to repo, then you have lost the level :( ", "file2")
|
||||
checkoutNew("other_branch")
|
||||
write("file3")
|
||||
addCommit("If this commit gets pushed to repo, then you have lost the level :( ", "file3")
|
||||
checkoutNew("test_branch")
|
||||
write("file4")
|
||||
addCommit("committed change on test_branch", "file4")
|
||||
git("remote", "add", "origin", File(remote, ".git").absolutePath)
|
||||
git("branch", "--set-upstream-to=origin/master", "master")
|
||||
checkout("master")
|
||||
true
|
||||
},
|
||||
validator = repoPredicate { repo -> "origin/test_branch" in repo.pushedBranches && "origin/master" !in repo.pushedBranches && "origin/other_branch" !in repo.pushedBranches },
|
||||
testCases = listOf(
|
||||
levelTestCase("push named branch", "git push origin test_branch"),
|
||||
|
||||
Reference in New Issue
Block a user