mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-03 12:40:05 +08:00
94 lines
3.0 KiB
Plaintext
Vendored
94 lines
3.0 KiB
Plaintext
Vendored
Describe gina#command#commit
|
|
Before all
|
|
let Path = vital#gina#import('System.Filepath')
|
|
let slit1 = Slit(tempname(), 1)
|
|
call slit1.write('A/foo.txt', [])
|
|
call slit1.write('B/foo.txt', [])
|
|
call slit1.execute('add .')
|
|
call slit1.execute('commit -m "First"')
|
|
call slit1.write('C/foo.txt', [])
|
|
call slit1.execute('add .')
|
|
End
|
|
|
|
After all
|
|
%bwipeout!
|
|
End
|
|
|
|
Describe Use cases
|
|
Before
|
|
%bwipeout!
|
|
execute 'edit' fnameescape(slit1.worktree)
|
|
End
|
|
|
|
It might be called without arguments
|
|
GinaSync commit
|
|
Assert Equals(winnr('$'), 1)
|
|
Assert Equals(bufname('%'), printf('gina://%s:commit', slit1.refname))
|
|
Assert Equals(getline(1, 3), [
|
|
\ '',
|
|
\ '# Please enter the commit message for your changes. Lines starting',
|
|
\ '# with ''#'' will be ignored, and an empty message aborts the commit.',
|
|
\])
|
|
" Commit commitmsg
|
|
call setline(1, ['Test Message']) | wq
|
|
Assert Equals(slit1.execute('log --pretty=format:%s'), [
|
|
\ 'Test Message',
|
|
\ 'First',
|
|
\])
|
|
" Reset
|
|
call slit1.execute('reset --soft HEAD@{1}')
|
|
End
|
|
|
|
It might be called with --verbose
|
|
GinaSync commit --verbose
|
|
Assert Equals(winnr('$'), 1)
|
|
Assert Equals(bufname('%'), printf('gina://%s:commit', slit1.refname))
|
|
Assert Equals(getline(1, 3), [
|
|
\ '',
|
|
\ '# Please enter the commit message for your changes. Lines starting',
|
|
\ '# with ''#'' will be ignored, and an empty message aborts the commit.',
|
|
\])
|
|
Assert True(index(getline(1, '$'), '# ------------------------ >8 ------------------------') >= 0)
|
|
" Commit commitmsg
|
|
call setline(1, ['Test Message']) | wq
|
|
Assert Equals(slit1.execute('log --pretty=format:%s'), [
|
|
\ 'Test Message',
|
|
\ 'First',
|
|
\])
|
|
" Reset
|
|
call slit1.execute('reset --soft HEAD@{1}')
|
|
End
|
|
|
|
It might be called with --amend
|
|
GinaSync commit --amend
|
|
Assert Equals(winnr('$'), 1)
|
|
Assert Equals(bufname('%'), printf('gina://%s:commit', slit1.refname))
|
|
Assert Equals(getline(1, 4), [
|
|
\ 'First',
|
|
\ '',
|
|
\ '# Please enter the commit message for your changes. Lines starting',
|
|
\ '# with ''#'' will be ignored, and an empty message aborts the commit.',
|
|
\])
|
|
" Commit commitmsg
|
|
call setline(1, ['Test Message']) | wq
|
|
Assert Equals(slit1.execute('log --pretty=format:%s'), [
|
|
\ 'Test Message',
|
|
\])
|
|
" Reset
|
|
call slit1.execute('reset --soft HEAD@{1}')
|
|
End
|
|
|
|
It might be called with --message={message}
|
|
GinaSync commit --message="Test Message"
|
|
Assert Equals(winnr('$'), 1)
|
|
Assert NotEquals(bufname('%'), printf('gina://%s:commit', slit1.refname))
|
|
Assert Equals(slit1.execute('log --pretty=format:%s'), [
|
|
\ 'Test Message',
|
|
\ 'First',
|
|
\])
|
|
" Reset
|
|
call slit1.execute('reset --soft HEAD@{1}')
|
|
End
|
|
End
|
|
End
|