- show Git editor file paths instead of the submitted git command - surface follow-up commit message editors during interactive rebase reword - add rename-commit UI tests for editor and amend-message solution paths - add broader embedded level solution scenarios for alternate Git workflows
60 lines
1.8 KiB
Kotlin
60 lines
1.8 KiB
Kotlin
package solutions.tretter.githugandroid
|
|
|
|
import org.junit.Assert.assertEquals
|
|
import org.junit.Assert.assertNull
|
|
import org.junit.Test
|
|
|
|
class GitEditorCommandsTest {
|
|
@Test
|
|
fun commitWithoutMessageOpensEditor() {
|
|
val invocation = parseGitEditorInvocation("git commit")
|
|
|
|
assertEquals(GitEditorCommandKind.COMMIT_MESSAGE, invocation?.kind)
|
|
assertEquals("Edit Commit Message", invocation?.title)
|
|
assertEquals(".git/COMMIT_EDITMSG", invocation?.displayPath)
|
|
}
|
|
|
|
@Test
|
|
fun commitWithMessageDoesNotOpenEditor() {
|
|
assertNull(parseGitEditorInvocation("git commit -m \"message\""))
|
|
}
|
|
|
|
@Test
|
|
fun commitAllWithCombinedMessageOptionDoesNotOpenEditor() {
|
|
assertNull(parseGitEditorInvocation("git commit -am \"message\""))
|
|
}
|
|
|
|
@Test
|
|
fun amendNoEditDoesNotOpenEditor() {
|
|
assertNull(parseGitEditorInvocation("git commit --amend --no-edit"))
|
|
}
|
|
|
|
@Test
|
|
fun interactiveRebaseOpensTodoEditor() {
|
|
val invocation = parseGitEditorInvocation("git rebase -i HEAD~3")
|
|
|
|
assertEquals(GitEditorCommandKind.REBASE_TODO, invocation?.kind)
|
|
assertEquals("Edit Rebase Todo", invocation?.title)
|
|
assertEquals(".git/rebase-merge/git-rebase-todo", invocation?.displayPath)
|
|
}
|
|
|
|
@Test
|
|
fun bareInteractiveRebaseDoesNotOpenTodoEditor() {
|
|
assertNull(parseGitEditorInvocation("git rebase -i"))
|
|
}
|
|
|
|
@Test
|
|
fun annotatedTagWithoutMessageOpensEditor() {
|
|
val invocation = parseGitEditorInvocation("git tag -a v1.0")
|
|
|
|
assertEquals(GitEditorCommandKind.TAG_MESSAGE, invocation?.kind)
|
|
assertEquals("Edit Tag Message", invocation?.title)
|
|
assertEquals(".git/TAG_EDITMSG", invocation?.displayPath)
|
|
}
|
|
|
|
@Test
|
|
fun lightweightTagDoesNotOpenEditor() {
|
|
assertNull(parseGitEditorInvocation("git tag v1.0"))
|
|
}
|
|
}
|